私は最初のiOSアプリケーションを作成しようとしており、このチュートリアルではUIAlertViewの使用を依頼しました。 XCodeはこれが非難され、UIAlertControllerを使うべきだと私に伝えました。私はUIAlertViewのインスタンスをUIAlertControllerに置き換え、まだ問題に遭遇しています。「UIAlertControllerの表示されない@interfaceはセレクタのinitWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles: ' を宣言します。 。私のコードは以下の通りです:。。IOS/Objective C開発の新機能、 UIAlertView/Controllerの問題
//
// ViewController.m
// cv
//
// Created by Frank Michael Tocci on 6/17/16.
// Copyright © 2016 Frank Tocci. All rights reserved.
//
#import "ViewController.h"
@interface ViewController()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIAlertController * alert = [[UIAlertController alloc] initWithTitle:@"Hello!" message:@"Welcome to OpenCV" delegate:self cancelButtonTitle:@"Continue" otherButtonTitles:nil];
[alert show];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
'UIAlertView'と' UIAlertController'は2つの異なるものです。また、 'UIAlertView'は非推奨です。 – liamnichols
UIalertControllerのドキュメントとその使い方をお読みください! –