相关疑难解决方法(0)

iOS如何通过宏检测iPhone X,iPhone 6 plus,iPhone 6,iPhone 5,iPhone 4?

如何通过宏检测设备模型?我曾经使用过这样的东西但模拟器上的结果总是IS_IPHONE_5

#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_IPHONE_5 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 568.0)
#define IS_IPHONE_6 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 667.0)
#define IS_IPHONE_6PLUS (IS_IPHONE && [[UIScreen mainScreen] nativeScale] == 3.0f)
#define IS_IPHONE_6_PLUS (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 736.0)
#define IS_RETINA ([[UIScreen mainScreen] scale] == 2.0)  
Run Code Online (Sandbox Code Playgroud)

iphone macros detect

110
推荐指数
9
解决办法
8万
查看次数

UISplitViewController:如何强制在app启动时显示主popover?(肖像)

在iPad App中我正在使用UISplitViewController.当应用程序以纵向模式启动时,我需要强制显示主弹出窗口.

现在我正在使用此代码,它在iOS 5.0上运行良好.

if (UIInterfaceOrientationIsPortrait(self.interfaceOrientation)) {
   if ([[[AppDelegate sharedAppDelegate] splitViewController] respondsToSelector:[[[AppDelegate sharedAppDelegate] btnMenu] action]]) {
      [[[AppDelegate sharedAppDelegate] splitViewController] performSelector:[[[AppDelegate sharedAppDelegate] btnMenu] action]];
   }            
}
Run Code Online (Sandbox Code Playgroud)

但是在iOS 5.1(使用新型主弹出窗口)中,行为似乎是随机的.有时弹出窗口全屏显示,有时效果很好.

5.1的一些建议?

portrait ipad uisplitviewcontroller ios5 ios5.1

26
推荐指数
5
解决办法
2万
查看次数

如何以编程方式触发uibarbuttonitem click事件

我创造了一个 UIActionSheet

UIActionSheet * action = [[UIActionSheet alloc]initWithTitle:@""
                                                              delegate:self
                                                     cancelButtonTitle: @"cancel"
                                                destructiveButtonTitle: @"OK"
                                                     otherButtonTitles: nil];
          [action showInView:self.view];
          [action release];
Run Code Online (Sandbox Code Playgroud)

在取消按钮的事件中,UIActionSheet我想要触发一个事件UIBarButtonItem,这在我看来.

我的问题是如何在UIActionSheet委托方法中触发按钮事件(不触摸按钮)

iphone events uibarbuttonitem uiactionsheet ios

18
推荐指数
3
解决办法
2万
查看次数