开发者

How to choose which view to choose at launch time in iPhone app?

I am writing an application that checks a boolean on a remote server. On the basis of received response - YES or NO - decides which UIView to开发者_如何学JAVA launch at initialise time. Is the anyway to decide which UIView to pick?


In or after your appDelegate's applicationDidLaunch method, you can set your main window's rootViewController to the ViewController you want to use.


of course there is. one method is: you can make 2 xibs for different views then:

UIView *view_ = nil;

if(serverResponse)
{
NSArray *views= [[NSBundle mainBundle] loadNibNamed:@"ViewTypeOne1"
                                                  owner:self
                                                options:nil];

view_ = [ nibViews objectAtIndex: 1];

}
else
{
NSArray *views= [[NSBundle mainBundle] loadNibNamed:@"ViewTypeOne2"
                                                  owner:self
                                                options:nil];

view_ = [ nibViews objectAtIndex: 1];
}

//if it is to be set for a controller
controller.view = view_;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜