// // FatherController.m // Ifish // // Created by imac on 15/10/29. // Copyright © 2015年 imac. All rights reserved. // #import "FatherController.h" @interface FatherController () @end @implementation FatherController - (void)viewDidLoad { [super viewDidLoad]; [self setNav]; } -(void)setNav{ UIButton *back = [UIButton buttonWithType:UIButtonTypeCustom]; back.frame = CGRectMake(0,0,48,44); [back setImage:[UIImage imageNamed:@"back_btn"] forState:UIControlStateNormal]; // [_bakbutton setBackgroundImage:[UIImage imageNamed:@"back_btn"] forState:UIControlStateNormal]; [back addTarget: self action: @selector(goBackAction) forControlEvents: UIControlEventTouchUpInside]; [back setContentEdgeInsets:UIEdgeInsetsMake(0, 10, 0, -10)]; back.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; UIBarButtonItem * backItem=[[UIBarButtonItem alloc] initWithCustomView:back]; self.navigationItem.leftBarButtonItem=backItem; } - (void)addTitleViewWithTitle:(NSString *)title{ UILabel*labe=[[UILabel alloc]initWithFrame:CGRectMake(0, 0,100, 44)]; labe.text=title; labe.textAlignment=NSTextAlignmentCenter; labe.textColor=[UIColor whiteColor]; labe.font = [UIFont systemFontOfSize:19]; self.navigationItem.titleView=labe; } -(void)goBackAction{ [self.navigationController popViewControllerAnimated:YES]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 0; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 0; } - (BOOL)prefersStatusBarHidden { return NO; } - (UIStatusBarStyle)preferredStatusBarStyle { return UIStatusBarStyleLightContent; } -(void)showTitle:(NSString*)title messsage:(NSString*)message{ UIAlertView *alert=[[UIAlertView alloc]initWithTitle:title message:message delegate:nil cancelButtonTitle:nil otherButtonTitles:nil, nil]; NSTimeInterval dismissSeconds=2.0; [alert show]; [self performSelector:@selector(dismissAlert:) withObject:alert afterDelay:dismissSeconds]; // UIAlertController *alertContorller=[UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; // UIAlertAction*cancleAction=[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]; // // UIAlertAction *sureAction=[UIAlertAction actionWithTitle:@"好的" style:UIAlertActionStyleDefault handler:nil]; // [alertContorller addAction:cancleAction]; // [alertContorller addAction:sureAction]; // [self presentViewController:alertContorller animated:YES completion:nil]; } -(void)dismissAlert:(UIAlertView*)alertView{ [alertView dismissWithClickedButtonIndex:[alertView cancelButtonIndex] animated:YES]; } @end