开发者

Create IBOutlet and connection with code

I am creating an iPad application that behaves like a power point presentational. I am creating several slides and each slides contains several images with basic functionalit开发者_运维问答y. Because I am creating so many slides it will be nice if I can create the IBOutles programmatically since I place so many buttons per slide for instance. it takes a while to place those outlets and create the connections. How can I speed up this process?


Why not just create every item programmatically?

Take a UIButton for example.

UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self 
           action:@selector(aMethod:)
 forControlEvents:UIControlEventTouchDown];
[button setTitle:@"Hello" forState:UIControlStateNormal];
button.frame = CGRectMake(40.0, 200.0, 170.0, 40.0);
[self.view addSubview:button];


This should be of interest to you: http://developer.apple.com/library/ios/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/030-Edit_User_Interfaces/edit_user_interface.html#//apple_ref/doc/uid/TP40010215-CH6-SW1

There's even a nice video tutorial if you click: "To create and connect a new outlet ..."

Good luck!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜