我正在维护一个基于SDK 6.0的旧iOS项目.
这个项目的方法称为
-(void) showComboBox:(UIView*)view:withOptions:(NSDictionary*)options
用于显示组合框.为了实现这一目标,它使用了UIActionSheet,这在iOS8上已弃用.
我的解决方案是这样的:
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber10_8) {
UIAlertController* alertController = [UIAlertController
alertControllerWithTitle:@"title"
message:@"message"
preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction* item = [UIAlertAction actionWithTitle:@"item"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
//do something here
//inform the selection to the WebView
...
[alertController dismissViewControllerAnimated:YES completion:nil];
}];
UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[alertController dismissViewControllerAnimated:YES completion:nil];
}];
[alertController addAction:item];
[alertController addAction:cancelAction];
//I am not sure whether it's the right way
if ([view.nextResponder isKindOfClass:UIViewController.class]) {
UIViewController* vc = (UIViewController*)view.nextResponder;
[vc presentViewController:alertController animated:YES completion:nil]; …
Run Code Online (Sandbox Code Playgroud) 我们都知道这种方法[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
可以从通知中心移除我们应用程序的所有远程通知。但是,出于某种原因,我想删除用户点击通知中心的那个,而保留其他的。
它有什么方法可以做到吗?
我在我的应用程序中使用HMSegmentedControl.我在视图控制器A中创建了一个HMSegmentedControl实例,然后跳转到视图控制器B来收集数据,如下所示:
[self presentViewController:vc animated:YES completion:nil];
然后我回去查看控制器A并根据视图控制器B中的值更改了HMSegmentedControl的标题.我曾经setSectionTitles:
做过这个工作.在我点击其中一个标题之前标题没有刷新,但我希望它立即刷新.怎么做?
我尝试过self.view setNeedsDisplay
但没有奏效.