Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Sam Chaudry
25,519 PointsCan some one explain these to me.....
I've just been looking at the Twitter Composer class and setting the initial method. How come it's return value is BOOL ? I've seen this around the apple documentation and I'm not sure why it's return type is BOOL?
setInitialText: Sets the initial text for a tweet.
- (BOOL)setInitialText:(NSString *)text
Also I came across this in the UILabel Class reference.....Again any help understanding this would be appreciated...
text The text displayed by the label.
@property(nonatomic, copy) NSString *text Discussion This string is nil by default.
In iOS 6 and later, assigning a new value to this property also replaces the value of the attributedText property with the same text, albeit without any inherent style attributes. Instead the label styles the new string using the shadowColor, textAlignment, and other style-related properties of the class. Thanks
Sam
5 Answers
Mike Bronner
16,395 PointsTake a look here at the API documentation: https://developer.apple.com/library/ios/documentation/Twitter/Reference/TWTweetSheetViewControllerClassRef/Reference/Reference.html#//apple_ref/doc/uid/TP40010943-CH1-DontLinkElementID_13
It states that it the instance method returns a boolean to designate success or failure. So even if you aren't using the return value, you could use the return value to detect if it failed, and handle the failure gracefully, letting the user know what's happening.
Sam Chaudry
25,519 PointsAwesome thanks Mike thats cleared up a lot for me!! Any chance you could explain the second part of my post? Much appreciated it if you can...
Mike Bronner
16,395 PointsI'm not quite sure I understand the problem in the second part of your question. Could you rephrase?
Sam Chaudry
25,519 PointsHi Mike, basically I lifted the second section out of the Apple Documentation from the UICLass reference. I was wondering if you could explain how to better interpret this?
Mike Bronner
16,395 PointsIf I understand correctly, the difference between attributedText and text properties of UILabel are:
- attributedText: rich-formatted text, with color, styling, etc. Use this if you want to set or preserve a certain styling in the label.
- text: non-formatted standard text, which will assume the styling of the label. Use this is your text isn't styled (i.e. no bold, underlined, color, etc.).
Does that help? :)
Sam Chaudry
25,519 PointsThat clears it up thanks Mike, appreciate you getting back to me!
Mike Bronner
16,395 PointsGlad to help! :) Good luck with your project.