ios一些开发中遇到的小知识点

本文详细介绍了iOS应用中界面弹出与导航的操作方法,包括如何使用UINavigationController进行界面切换,以及如何自定义导航栏按钮和修改导航栏标题样式。通过实例演示,帮助开发者掌握界面管理与导航控制的基本技能。

界面重下到上弹出,

弹出方法

addResumes为要弹出的画面对象

 addResumes=[[AddResumes alloc]initWithNibName:@"AddResumes" bundle:nil];     

   // [self.navigationController pushViewController:addResumes animated:YES];

    nav=[[UINavigationController alloc]initWithRootViewController:addResumes];

    [self.navigationController presentModalViewController:nav animated:YES];

返回时调用方法

[self.navigationController dismissModalViewControllerAnimated:YES];

这一对方法是将控制权转交给下个navigationcontroller控制,和左右不一样,左右是将目前界面往堆栈里面压,将新的界面添加进来

左右对应的方法为

[self.navigationController pushViewController:resumeDetail animated:YES];

[self.navigationController popViewControllerAnimated:YES];

更多此类方法看api。

自定义navigation 按钮方法

   UIBarButtonItem *rightbuttonitem=[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"nav_btn_email.png"]

                                                                                         style:UIBarButtonItemStylePlain

                                                                                        target:self

                                                                                        action:@selector(mailway)];


    self.navigationItem.rightBarButtonItem=rightbuttonitem;

修改navigationtitle字体什么的,添加视图,想怎么改怎么改

  UILabel *navtitle=[[UILabel alloc]init];

    [navtitle setFont:[UIFont fontWithName:@"TimesNewRomanPS-BoldMT" size:20]];

    [navtitle setText:@"Objective"];

    navtitle.textColor=[UIColor whiteColor];

    [navtitle setFrame:CGRectMake( -70, -13, 140, 25)];

    navtitle.textAlignment=UITextAlignmentCenter;

    [navtitle setBackgroundColor:[UIColor clearColor]];

    navtitle.shadowColor=[UIColor darkGrayColor];

    [navtitle setShadowOffset:CGSizeMake(-0.5, -1)];

    UIView *myview=[[UIView alloc]init];

    [myview addSubview:navtitle];

    [navtitle release];

    [self.navigationItem setTitleView:myview];

    [myview release];



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值