0

为什么这个不显示?我尝试了模拟器 5.1 和 6.0。最近有什么变化吗?

UIBarButtonItem* rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPageCurl target:self action:@selector(openGasMileage)];

self.navigationItem.rightBarButtonItem = rightBarButtonItem;
4

1 回答 1

1

由于 >= ios5 sdk 中不存在默认 curl 图像,因此您必须使用自己的图像:

- (UIBarButtonItem *) rightBarButtonItem {
    if (_rightBarButtonItem == nil) {
    UIButton *rightButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
    [rightButton setImage:[UIImage imageNamed:@"edit.png"] forState:UIControlStateNormal];
    [rightButton addTarget:self action:@selector(own) forControlEvents:UIControlEventTouchUpInside];
    _rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightButton];
    }
return _rightBarButtonItem;
}

self.navigationItem.rightBarButtonItem = self.rightBarButtonItem;

另见:卷曲项目

于 2012-10-29T19:58:30.730 回答