前两天复习Cocoa编程的小结--NSNumberFormatter ,UIBarButtonItem

~学习新对象NSNumberFormatter

NSNumberFormatter *formatter= [[NSNumberFormatteralloc]init];

    [formatter setNumberStyle:NSNumberFormatterCurrencyStyle];//建一个NSNumberFormatter并为NSNumber设置货币格式

    boxOfficeGrossLabel.text =[formatterstringFromNumber:movie.boxOfficeGross];

 


   

~~所犯错误  出现莫名丢失对象数据的情况 以及一段重构良好的视图切换代码,是视图切换!不是控制器切换哦

@propertyMovie * nMovie;

@property (strong, ›nonatomic)IBOutletUITextField*titleField;

    if (self.blueViewController.view.superview ==nil) {

        coming = blueViewController;

        going = yellowViewController;

        transition = UIViewAnimationTransitionFlipFromRight;

        

    } else {

        coming = yellowViewController;

        going = blueViewController;

        transition = UIViewAnimationTransitionFlipFromLeft;

    }

    [UIView setAnimationTransition:transitionforView:self.viewcache:YES];

  

   

    [coming viewWillAppear:YES];

    [going viewWillDisappear:YES];

   

    [going.view removeFromSuperview];

    [self.viewinsertSubview:coming.viewatIndex:0 ];

   

    [coming viewDidAppear:YES];

    [going viewDidDisappear:YES];

   

     [UIView commitAnimations];

 

~~给导航条增加右侧add按钮的方法

    UIBarButtonItem*addButton = [[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAddtarget:selfaction:@selector(insertNewObject:)];

    self.navigationItem.rightBarButtonItem =addButton;

//UIBarButtonItem和UIButton不是同一派系,它不是继承自UIControll(继承自UIView,UIResponder)的娃儿

 

 

~~~在导航条增加中间视图的方法,Xcode4想直接在IB中放置TitleView是不行的了,但其实影响不大.用代码self.navigationItem.titleView =self.segment;就可以了.  在视图里设置为有导航条的模式,可以大概看一下View添加的效果(不是实际的效果),只要给试图添加IBOutlet就可以使用上面的代码添加了.

    由于navigationItem是每个ViewController继承来的东西,并且只有三个位置,所以就算不能直接在IB设置也无所谓.别忘了,代码才是王道.IB上的东西没有和代码连接起来,就毫无灵活的用处.

 

 

~~关于controller的editButtonItem和自定义的 有表格视图风格状态转换的按钮. This methodallows the delegate to customize the editing style of the cell locatedatindexPath. If the delegate does not implement this method and theUITableViewCell object is editable (that is, it has itsediting property set toYES), the cell has theUITableViewCellEditingStyleDelete style set forit.

 

定制edingstyle的协议方法是:

tableView:editingStyleForRowAtIndexPath:当表格视图默认是可编辑时,无实现是默认是删除的风格. 当开启可移动的风格是,必须在此返回none的风格UITableViewCellEditingStyleNone

 

 

 

 

用户提交后 处理风格的方法在这里tableView:commitEditingStyle:forRowAtIndexPath:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值