UIButton buttonWithType:101,他们会拒绝我的应用吗?

时间:2011-04-28 10:16:05

标签: iphone objective-c app-store itunes ios

问候,

在我的一个项目中,我想在导航栏中创建后退类型按钮(带指针),我用Google搜索,发现使用以下代码,可以实现。

  

UIButton * someButton = [UIButton buttonWithType:101];
  UIBarButtonItem * someBarButton = [[UIBarButtonItem alloc] initWithCustomView:someButton];

我想在Apple的应用商店上传此应用。 有没有机会这会让我的应用被拒绝,因为buttonWithType:101没有记录在哪里? 此外,我没有以其通用方式使用此按钮项,即它不会弹出视图控制器 请指导。
的问候,

3 个答案:

答案 0 :(得分:8)

我建议您根据需要生成图像,只需运行此代码并在生成图像后将其删除:

- (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]; 

...
}

答案 1 :(得分:5)

很可能是的......在某些情况下,很少有事情会在雷达之下,但为什么要抓住机会......

如果你是为你的客户/公司做这件事,你是否有可能在手上拒绝app store ..

创建指向按钮图像并将其与自定义按钮一起使用更安全......

答案 2 :(得分:1)

如果您正在尝试控制导航控制器的后退按钮中显示的文本,则可以使用UIViewController的UINavigationItem执行此操作。它可以包含当前视图的标题和用于下一个视图的“后退”按钮的文本。这也可以在XIB中设置。