查找应用程序的主窗口对象。一般情况就是UIWindow。当然一个应用程序可以有多个window,键盘是一个window,[[UIApplication sharedApplication] keyWindow]就是查找当前应用程序的主window
用法:比如,我们需要添加一个UIActionSheet,可以这样:
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"请登陆会员中心" delegate:self cancelButtonTitle:@"返回" destructiveButtonTitle:nil otherButtonTitles:@"登录", nil];
[sheet showInView:
[
UIApplication sharedApplication].keyWindow];