I watched a video saying that UIAlertView
only works when importing UIKit.h. However, if I comment on the import statement in the header file:
//#import <UIKit/UIKit.h> @interface ViewController : UIViewController @end
the warning still works when I add it to the implementation file:
- (void)viewDidLoad { [super viewDidLoad]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Title" message:@"Message" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; [alert show]; }
Please explain why this works? What is the true role of UIKit?
source share