In my app i need to assign a string as a title for the uibutton.
How can i do this.For example
NSString *date=[[NSString alloc]initwithString:@"Todays Date"];
//am trying to assign the date content as a title for my button
[Button setTitle:date state:ForNormalSatate];
开发者_运维技巧
How can i set title as "Todays Date" for the button
The syntax for setting a button title is:
[myButton setTitle:date forState:UIControlStateNormal];
Or are you more interested in getting the date as a string ? Look up the documentation for NSDateFormatter. If you have trouble with it, search StackOverflow for it.
BTW 1: Don't forget to release your date string.
加载中,请稍侯......
精彩评论