自定义UIBarButtonItem右边的视图

    UIButton *refreshButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 60, 35)];
    [refreshButton setBackgroundImage:[UIImage imageNamed:@"cancel_btn.png"] forState:UIControlStateNormal];
    [refreshButton addTarget:self action:@selector(updatePictureNews:) forControlEvents:UIControlEventTouchUpInside];
    
    
    UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:refreshButton];
    self.navigationItem.rightBarButtonItem = leftBarButtonItem;
posted @ 2012-07-14 11:16  FoxBabe  阅读(873)  评论(0编辑  收藏  举报