I am using cbpowell/MarqueeLabel class in my project. I changed the class of a Label from UILabel to MarqeeLabel. This got my Label to scroll. But it is in its Default MLLeftRight. I need to change it to MLContinous. How can I make this happen? I tried add a User Defined RunTime attribute, but that doesn't work. I cannot add "marqueeType" in the program, because my label is still in the UILabel class instead of MarqueeLabel, so can only access the methods for UILabel.
Anyone with experience in MarqueeLabel, please advice.
Or if you can tell me, how I can access the methods of a custom class I set(here- MarqueeLabel) for my label (instead of- UILabel)
You can create an IBOutlet for MarqueeLabel like
#property (weak, nonatomic) IBOutlet MarqueeLabel *mLabel;
Since it deoesn't support IBInspectable for marqueeType, you can configure label like
self.mLabel.marqueeType = MLLeftRight;
Related
In Xcode 6, can you have a UIButton property in your header file display in interface builder by setting the property as IBInspectable? The button is created entirely in code. Something like #property (nonatomic, retain) IBInspectable UIButton *directions;
I don't think uibutton are inspectable type. But why don't you just use a IBOutlet?
IBInspectable is just a way to design a set of none UI properties which can be then be accessible in IB to help you customize your class via the attribute inspector.
If you want to have a preview of your custom button, you should use IBDesignable, but in this case it doesn't apply to a property but a class.
IBDesignable allow to have a preview in IB of your view.
Check this article: http://www.weheartswift.com/make-awesome-ui-components-ios-8-using-swift-xcode-6/
I'm trying to change the color of some placeholder text, of a UITextField, but i having problems reaching the text field. I've created a property with Referencing Outlets, like this:
#property (retain, nonatomic) IBOutlet UITextField *usernameField;
But can't reach it with either usernameField or _usernameField. What am i missing?
If you have a property, do NOT synthesize it. That just complicates things, and is no longer needed in Objective C 2.0.
Don't use _usernameField. That bypasses the property getter/setter and accesses the iVar directly.
Use self.usernameField instead. Until you understand the difference, use the property except in the code of a custom getter/setter or dealloc method.
first you should use self.usernameField and second just make sure you assigned the outlet to the UITextField you need to access it in the Interface Builder.
You can check it. Have you connected the outlet of the textfield in the xib file?
Quite a simple one I assume but searching has failed me.
I have a UITextView I set up in a Storyboard with some dummy text. Dynamically I would like to change the content of this, but I don't know how. Searching for this seems to only returns results in which the UITextView has been created programmatically as opposed to via a drag and drop on the Storyboard, hence they have direct access to a variable representing it.
Add an outlet to UITextView then changed it dynamically!
Like this:
#property (weak, nonatomic) IBOutlet UITextView *yourText;
self.yourText.text = // ANY TEXT HERE
I have a class called cell.h
#import <UIKit/UIKit.h>
#interface TokenCell : UITableViewCell
#property (strong, nonatomic) IBOutlet UILabel *idlabel;
#property (strong, nonatomic) IBOutlet UILabel *tokenlabel;
#end
In this app im trying to retrieve data from a server using Restkit, but this works right, the issue is more simple. I cant make a reference of this objects on Main.storyboard, XCode 5 just doesn't let me do this and the label properties that I created dont show in any way. I cant find where is the issue, so some help will be welcome. This Is very strange, because on my last test app I didn't have any problems doing this.
Just check you have given the class name in the storyboard file.
Check that you've specified TokenCell as the custom class for your UITableView cells:
(Here are 2 images to illustrate - I can't show inline images as I am new to StackOverflow!)
1. image - highlight the cell in your Main.storyboard
2. image - set the class to TokenCell, then save
I've got a handful of UIViews subclasses as a part of my interface and I'm looking for an easy human readable way to differentiate them in the code -- like the label you set in the "Document" section of the UI editor.
I believe the "Accessibility Label" is exposed, but that doesn't seem like the correct use of that variable.
Am I stuck documenting which Object ID each object has or is there a more intelligible way?
There are lots of ways to do what you want to be done. Here are several of them:
#properties
The first thing that came to my mind are properties. Use your view controller as a storage class by adding following property declarations in your header file:
#property (nonatomic, weak) IBOutlet UIView *myFantasticView;
#property (nonatomic, weak) IBOutlet UIView *myGorgeousView;
...
Then, just simply connect your views to specific outlets in Interface Builder.
The only drawback is that you will have to declare a lot of properties which can become a little confusing.
Custom runtime attributes (another use of #properties)
If you're using UIView's subclasses (I assume you do), you can use your UIView subclass and declare an "identifier" property:
#interface MyView : UIView
#property (nonatomic, strong) NSString *myViewID;
...
#end
Then, assign this value using code (simple property setting) or in Interface Builder:
Now you can identify your views using one of those method. But remember that you can come up with a better, more suitable solution! :)