开发者

How to display text in subview by button click?

Hi I am new to iPhone.

What I need is, have to开发者_如何学编程 display some text as help for my application. For that I create a button while clicking that button text must be displayed.

How can I do this?

Please post some code. Thank you.


Inside your button click event,

for example.

-(IBAction) showTextView:(id)sender{

yourSubViewController * subView = [[yourSubViewController alloc]    initWithNibName:@"yourSubViewController" bundle:nil];

[self.navigationController pushViewController:subView animated:YES];

}

and inside yourSubViewController viewDidLoad method,

UITextView * textView = [[UITextView alloc] initWithFrame:CGRectMake(10, 10, 200, 200)];

textView.text = @"display your info text";

[self.view addSubview:textView];

before you must declare UITextViewDelegate in yourSubViewController.h


on button click event load new UIviewController.

add uitextview in it and load your help text in that textview

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜