一、NSNotification通知:
(1)发送通知:
[[NSNotificationCenter defaultCenter] postNotificationName:@"pass" object:nil userInfo:dic];
(2)接收通知:
[[NSNotificationCenter defaultCenter] addObserver:self or:@or(updata:) name:@"pass" object:nil];
(3)移除通知:
[[NSNotificationCenterdefaultCenter] removeObserver:self name:@"popView" object:nil];
二、隱藏 status bar
idsharedApp = [UIApplication sharedApplication];
[sharedAppsetStatusBarHidden:YES animated:NO];
就是最上面那一條顯示時間和電池的玩意兒。
兼容5.0以下ios版本的UINavigationBar修改图片
@implementationUINavigationBar (CustomImage)
-(void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed:@"top_bg.png"];
[image drawInRect:CGRectMake(0, 0,self.frame.size.width,self.frame.size.height)];
}
@end
三、UIActionSheet在窗口界面上(类似于UITabBarController等界面)取消按钮不灵活的解决办法
UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:message delegate:self cancelButtonTitle:@"Cancel"destructiveButtonTitle:@"OK" otherButtonTitles:nil];
actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
[actionSheetshowInView:[UIApplication sharedApplication].keyWindow];//要显示在主界面上
[actionSheetrelease];