开发者

How to assign string in a variable as a title for button?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜