开发者

UIViewController with no Xib showing blank when using pushViewController

I have subclassed UIViewController like so:

@interface MyClass : UIViewController

I dont have a xib file for the controller, instead I would just like to use a blank UIView and I will layout elements programmatically on that. The problem arrises when I try and push this view controller.

MyClass * thing = [[ImageGallery alloc] init];
[self.navigationController pushViewController:thing animated:YES];

A new title bar is animated in, but there is no view, its see throug开发者_开发百科h, so I end up seeing a static background I set on my main "window/view". How should I properly subclass a UIViewController without a xib?


What you have described is correct behaviour so far.

You will want to override the -(void)loadView method, and after the [super loadView]; call, you can set your background colour and begin to place the objects in programatically, that you desire.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜