我遇到一个小问题。我有一个视图应该在尝试添加视图加载时设置为隐藏
[self.view setHidden:YES];
在viewWillAppear中并且视图隐藏但隐藏视图是可见的(在加载应用程序后需要一瞬间隐藏)。我需要隐藏视图而不显示它。帮助我?
我在viewDidAppear中的完整代码
-(void)viewDidAppear:(BOOL)animated
{
@try {
NSLog(@"\n\n--------------Mainview Controller------------\n");
// Guided access mode call mainview in iOS7. It making issue in UI
[getStartBox setHidden:NO];
appDel.deviceModel=[self platformString];
if([MainView checkRegistrationStatus])
{
NSLog(@"Already registered....");
[main setGlobalValues];
if ([appDel.configArray count]==0)
{
NSLog(@"Load app sync page...");
[self.view setHidden :YES];
// [_mainView setHidden:YES];
AppSync *sync=[[AppSync alloc]initWithNibName:@"AppSync" bundle:nil];
sync.appSyncData = configureData;
[self presentViewController:sync animated:NO completion:nil];
}
else
{
NSLog(@"%@",appDel.logInStatus);
if([appDel.logInStatus isEqualToString:@"false"])
{
[self.view setHidden :YES];
// [_mainView setHidden:YES];
NSLog(@"Load login view controller...");
appDel.isEmergencyAlertOn=NO;
appDel.isRespondingToAlert=NO;
LogInViewController *loginView=[[LogInViewController alloc]initWithNibName:@"LogInViewController" bundle:nil];
[self presentViewController:loginView animated:NO completion:nil];
}
else if([appDel.logInStatus isEqualToString:@"true"])
{
NSLog(@"Load alert screen");
[self.view setHidden :YES];
// [_mainView setHidden:YES];
AlertScreen *alert=[[AlertScreen alloc]initWithNibName:@"AlertScreen" bundle:nil];
alert.alertData=notificationData;
[self presentViewController:alert animated:NO completion:nil];
}
}
}
else
{
appDel.domainName=nil;
// Version number reffered in settings page. The log enabled one should be in same format (Ex Version 1.0.53(log enabled))
versionLabel.text=@"Version 1.3(log enabled)";//(log enabled)
appDel.appVersion=versionLabel.text;
//self.view.layer.contents=(id)[[UIImage imageNamed:@"background.png"]CGImage];
[self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"background.png"]]];
ConfigureButton.hidden=NO;
}
}
@catch (NSException *exception) {
[[WriteLogger getWriteLogger] writeLog:moduleName sourceClass:self.nibName methodName:@"viewDidAppear" errorMsg:exception];
}