问候语,
在我的一个项目中,我想在导航栏中创建back-type按钮(带指针(,我在谷歌上搜索了一下,发现使用以下代码可以实现。
UIButton*someButton=[UIButtonWithType:101]
UIBarButtonItem*someBarButton=[[UIBarButton项分配]initWithCustomView:someButton];
我想在苹果的应用商店上传这个应用。这有没有可能让我的应用程序被拒绝,因为buttonWithType:101在哪里都没有记录?此外,我没有以它的通用方式使用这个栏按钮项目,即它不会弹出视图控制器
请引导
问候,
我建议您根据需要生成图像,只需运行此代码并在生成图像后将其删除即可:
- (void)viewDidLoad {
...
someButton = [UIButton buttonWithType:101];
UIBarButtonItem *someBarButton = [[UIBarButtonItem alloc] initWithCustomView:someButton];
self.navigationItem.leftBarButtonItem = someBarButton;
...
}
和
- (void)viewWillAppear:(BOOL)animated {
....
UIImage *img1 = [someButton backgroundImageForState:UIControlStateNormal];
NSData *newData = UIImagePNGRepresentation(img1);
NSFileManager *fileManager =[NSFileManager defaultManager];
BOOL filecreationSuccess = [fileManager createFileAtPath:@"/Users/macbookmac/Desktop/tester.png" contents:newData attributes:nil];
...
}
很可能是的。。在某些情况下,很少有事情会被忽视,但为什么要冒险呢。。
如果你这样做是为了你的客户/公司,你会面临被应用商店拒绝的风险吗。。
创建一个尖头按钮图像并将其与自定义按钮一起使用更安全。。。
如果您试图控制导航控制器的后退按钮中显示的文本,可以使用UIViewController的UINavigationItem来控制。它可以包含当前视图的标题和用于下一个视图的"后退"按钮的文本。这也可以在XIB中设置。