您好,我有一点问题。
我收到了一个项目申请,但这是一个有点旧的申请(IOS 7)。
我在互联网上看到如何使用好的旧UIAlertView的INSTEAD来更新UIAlertController。
//Fourth sample: declare a pointer to a 3 dimension array 2x2x4 elements
//using variables for dimensions
int x = 2;
int y = 2;
int z = 4;
int (*array4)[y][z];
array4 = ReadArray(file, 16, sizeof(int));
for (int i=0; i<x; i++)
{
for(int j=0; j<y; j++)
{
if(j) printf (" - ");
for (int k=0; k<z; k++)
printf("%d,", array4[i][j][k]);
}
printf("\n");
}
我收到一条我不明白的错误:
'RFduino'没有可见的@interface声明选择器'presentViewController:animated:completion'
答案 0 :(得分:12)
而不是使用它:
[self presentViewController: controller animated: YES completion: nil];
试试这个:
UIViewController *viewController = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
if ( viewController.presentedViewController && !viewController.presentedViewController.isBeingDismissed ) {
viewController = viewController.presentedViewController;
}
NSLayoutConstraint *constraint = [NSLayoutConstraint
constraintWithItem:alert.view
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationLessThanOrEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1
constant:viewController.view.frame.size.height*2.0f];
[alert.view addConstraint:constraint];
[viewController presentViewController:alert animated:YES completion:^{}];
答案 1 :(得分:2)
presentViewController: animated: completion:
是UIViewController
的一种方法。您调用此方法的类是UIViewController
?