开发者

Best way to use custom TTButton with interface builder

I am quite new to the whole IPhone development thing and was playing around with the Three20 library. The samples for this library showed me an easy way to create a nice looking button with styles etc and this to my view:

TTButton* button = [TTButton buttonWithStyle:@"forwardActionButton:" title:@"Login"];
[button setFrame:CGRectMake(245, 160, 65, 33)];
[self.view addSubview:button];

Works great. Now I have created a nib file in interface builder with my whole view layed out including all sorts of textfields etc.

What I would like to do is, is to create a placeholder for a button in Interface Builder and in my viewDid开发者_Python百科Load method replace this placeholder with the actual TTButton instance. This would prevent my from having to call setFrame with an hardcoded location and instead make the whole interface design process much more free.

I have already tried creating a UIView object in interface builder, changing the type to TTButton and then assigning a new instance but seems to put the new button at coordinates location 0,0.

Can anybody point me in the right direction on how to achieve this?


waseem,

Unfortunately three20 does not use interface builder at all. The best thing you can do is layout a mock-up view and grab button x-y locations from that, then use those to update your TTButton locations in code.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜