のこのメソッドを呼び出してUIView
、を別のものにプッシュしようとしています:UIView
UINavigationController
signupPageObj = [[SignupPage alloc]initWithNibName:@"SignupPage" bundle:nil];
[self.navigationController pushViewController:signupPageObj animated:YES];
しかし、 SignUpPage をロードするのにしばらく時間がかかりましUIView
た。理由はわかりませんが、viewDidLoad
メソッドと同様にカスタマイズがあまりないためinitWithNibName
です。
のコード全体をinitWithNibName
以下に示します。
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self)
{
statusArray=[[NSMutableArray alloc] init];
UILabel *labelforNavigationTitle = [[UILabel alloc] initWithFrame:CGRectZero];
labelforNavigationTitle.backgroundColor = [UIColor clearColor];
labelforNavigationTitle.font = [UIFont fontWithName:FONTSAVINGSBOND size:30.0];
labelforNavigationTitle.shadowColor = [UIColor colorWithWhite:0.0 alpha:0.5];
labelforNavigationTitle.textAlignment = UITextAlignmentCenter;
labelforNavigationTitle.textColor = [UIColor whiteColor]; // change this color
self.navigationItem.titleView = labelforNavigationTitle;
labelforNavigationTitle.text = NSLocalizedString(@"Sign Up", @"");
[labelforNavigationTitle sizeToFit];
}
return self;
}
-(void)viewDidLoad
{
[super viewDidLoad];
self.fullPathToFile=@"";
self.gender=@"";
strForGender=self.gender;
labelInDatePicker.font=[UIFont fontWithName:FONTCENTURYGOTHICBOLD size:17.0];
UIImage* imageCancel = [UIImage imageNamed:@"cancelbtn.png"];
CGRect frameimg = CGRectMake(0, 0, (imageCancel.size.width)/2, (imageCancel.size.height)/2);
UIButton *cancelButton = [[UIButton alloc] initWithFrame:frameimg];
[cancelButton setBackgroundImage:imageCancel forState:UIControlStateNormal];
[cancelButton addTarget:self action:@selector(cancelButtonclickedInAvtar)
forControlEvents:UIControlEventTouchUpInside];
[cancelButton setShowsTouchWhenHighlighted:YES];
self.pickerBirthdayView.frame=CGRectMake(0,460,320,252);
[self.view addSubview:self.pickerBirthdayView];
self.avtarView.frame=CGRectMake(0,460,320,460);
[self.view addSubview:self.avtarView];
cancelButtonInAvtarView=[[UIBarButtonItem alloc]initWithCustomView:cancelButton];
self.termsAndConditionPage.frame=CGRectMake(0,460,320,460);
[self.view addSubview:self.termsAndConditionPage];
if ([self.navigationController.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)] )
{
UIImage *image = [UIImage imageNamed:@"titlebg.png"] ;
[self.navigationController.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
}
[self performSelector:@selector(settingScrollView) withObject:nil afterDelay:1.0];
scrollPrevButton.hidden=YES;
scrollNextButton.hidden=NO;
isSectionExpanded=NO;
checkForImage=2;
termsAndConditionChecked=2;
checkForBackgroundImage=10;
start=10;
UIImage* image1 = [UIImage imageNamed:@"backbtn.png"];
CGRect frameimg1 = CGRectMake(0, 0, (image1.size.width)/2, (image1.size.height)/2);
UIButton *backButton = [[UIButton alloc] initWithFrame:frameimg1];
[backButton setBackgroundImage:image1 forState:UIControlStateNormal];
[backButton addTarget:self action:@selector(popToRootViewController)
forControlEvents:UIControlEventTouchUpInside];
// UIImage* image2 = [UIImage imageNamed:@"submitbtn.png"];
// CGRect frameimg2 = CGRectMake(0, 0, (image2.size.width)/2, (image2.size.height)/2);
// UIButton *submitButton = [[UIButton alloc] initWithFrame:frameimg2];
// [submitButton setBackgroundImage:image2 forState:UIControlStateNormal];
// [submitButton addTarget:self action:@selector(submitButtonPressed:)forControlEvents:UIControlEventTouchUpInside];
UIImage* imageforTermsandConditionPage = [UIImage imageNamed:@"backbtn.png"];
CGRect frameimgforTermsandConditionPage = CGRectMake(0, 0, (imageforTermsandConditionPage.size.width)/2, (imageforTermsandConditionPage.size.height)/2);
UIButton *backButtonforTermsandConditionPage = [[UIButton alloc] initWithFrame:frameimgforTermsandConditionPage];
[backButtonforTermsandConditionPage setBackgroundImage:imageforTermsandConditionPage forState:UIControlStateNormal];
[backButtonforTermsandConditionPage addTarget:self action:@selector(backtoSignupPage) forControlEvents:UIControlEventTouchUpInside];
UIImage* imageforChooseIconPage = [UIImage imageNamed:@"backbtn.png"];
CGRect frameimgforChooseIconPage = CGRectMake(0, 0, (imageforChooseIconPage.size.width)/2, (imageforChooseIconPage.size.height)/2);
UIButton *backButtonforChooseIconPage = [[UIButton alloc] initWithFrame:frameimgforChooseIconPage];
[backButtonforChooseIconPage setBackgroundImage:imageforTermsandConditionPage forState:UIControlStateNormal];
[backButtonforChooseIconPage addTarget:self action:@selector(backtoSignupPage) forControlEvents:UIControlEventTouchUpInside];
backButton1 = [[UIBarButtonItem alloc] initWithCustomView:backButton];
self.navigationItem.leftBarButtonItem = backButton1;
// submitButton1=[[UIBarButtonItem alloc]initWithCustomView:submitButton];
// self.navigationItem.rightBarButtonItem=submitButton1;
backButtonInTermsAndCondition=[[UIBarButtonItem alloc]initWithCustomView:backButtonforTermsandConditionPage];
backButtonInChooseIcon=[[UIBarButtonItem alloc]initWithCustomView:backButtonforChooseIconPage];
CALayer *layer = [self.objTextView layer];
[layer setMasksToBounds:YES];
[layer setCornerRadius:10.0];
[layer setBorderWidth:0.0];
[layer setBorderColor:[[UIColor lightGrayColor] CGColor]];
}
-(void)settingScrollView
{
arrOfImages=[NSArray arrayWithObjects:@"Avtar0.png",@"Avtar1.png",@"Avtar2.png",@"Avtar3.png",@"Avtar4.png",@"Avtar5.png",@"Avtar6.png",@"Avtar7.png",@"Avtar8.png",@"Avtar9.png",nil];
pageControl.numberOfPages = kNumberOfPages;
pageControl.currentPage = 0;
pageControl = [[PageControl alloc] initWithFrame:rect] ;
pageControl.frame = rect;
pageControl.delegate=self;
pageControl.numberOfPages=[arrOfImages count];
pageControl.currentPage = self.currentPage;
[self.view addSubview:pageControl];
scrollV = [[UIScrollView alloc]init];
scrollV.frame=CGRectMake(35,55,250,246);
scrollV.backgroundColor=[UIColor clearColor];
scrollV.delegate=self;
scrollV.pagingEnabled=YES;
self.scrollV.contentSize = CGSizeMake(self.scrollV.frame.size.width *kNumberOfPages, 220);
self.scrollV.showsHorizontalScrollIndicator = NO;
self.scrollV.showsVerticalScrollIndicator = NO;
self.scrollV.scrollsToTop = NO;
self.scrollV.delegate = self;
[self.avtarView addSubview:scrollV];
for(int k =0;k<arrOfImages.count;k++)
{
UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];
btn.tag=k;
btn.imageView.contentMode= UIViewContentModeScaleAspectFit;
[btn setImage:[UIImage imageNamed:[arrOfImages objectAtIndex:k]] forState:UIControlStateNormal];
[btn setImage:[UIImage imageNamed:[arrOfImages objectAtIndex:k]] forState:UIControlStateHighlighted];
btn.frame=CGRectMake((self.scrollV.frame.size.width * k),0, 250,241);
[btn addTarget:self action:@selector(setImageInScrollView:) forControlEvents:UIControlEventTouchUpInside];
[self.scrollV addSubview:btn];
}
}
誰かがこれに対する提案や解決策を持っていれば、私はとても助かります。