1.根視圖
RootViewController *rootVC = [[RootViewController alloc] init];
self.window.rootViewController = rootVC;
[rootVC release];
添加圖片
相對路徑修改之后仍然可以正常顯示
絕對路徑如果文件位置修改那么就找不到了
imageView.image = [UIImage imageNamed:@"%%%FKP[A6RT}ZHB8[CNA[8W.jpg"];
獲取路徑(動態(tài)變化的絕對路徑)
參數(shù)1.文件名
參數(shù)2.文件后綴
2.導航視圖控制器 ? UINavigationController
標題
背景顏色
設置不透明 ? ? navigationController.navigationBar.translucent ? ?NO
隱藏方式 :
1.navigationBarHidden ? ? ? ? ? ? ? ? ? ?YES
2.navigationBar.hidden ? ? ? ? ? ? ? ? ? ?YES
樣式 ? self.navigationController.navigationBar.barStyle ? ? ? ? ? ? ? ? ?UIBarStyleBlack
修改導航欄上內容的顏色 ? self.navigationController.navigationBar.tintColor ? ? ? ? UIColor whiteColor
左右按鈕 ? ? self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:self action:@selector(left:)] autorelease];
創(chuàng)建導航視圖控制器
MainViewController *mainVC = [[MainViewController alloc]init];
UINavigationController *naVC = [[UINavigationController alloc]initWithRootViewController:mainVC];
self.window.rootViewController = naVC;
[mainVC release];
[naVC release];
觸發(fā)事件進入下一頁
[self.navigationController pushViewController:secVC animated:YES];
協(xié)議傳值
從后向前傳值
協(xié)議傳值__SecondViewController.h
1.聲明一份協(xié)議
@protocol SecondViewControllerDelegate//協(xié)議方法
-(void)changeValue:(NSString *)value;
@end
@interface SecondViewController : UIViewController
2.設置代理人的屬性
@property(nonatomic,assign)iddelegate;
@end
協(xié)議傳值__SecondViewController.m
3.設置代理人執(zhí)行的協(xié)議方法--寫在需要執(zhí)行事件方法里
-(void)click:(UIButton *)button{
[self.delegate changeValue:self.textField.text];
}
協(xié)議傳值__MainViewController.m
4.簽訂協(xié)議
@interface MainViewController ()
5.設置代理人對象
secVC.delegate = self;
6.實現(xiàn)協(xié)議方法
-(void)changeValue:(NSString *)str{
}
屬性傳值
從前向后傳值
屬性傳值__SecondViewController.h
1.在第二個頁面寫一條屬性
@property(nonatomic,assign)NSInteger number;
針對字符串寫一條屬性
@property(nonatomic,copy)NSString *str;
@property(nonatomic,retain)NSArray *arr;
屬性傳值__MainViewController.h
2.屬性傳值的第二步
-(void)click:(UIButton *)button{
SecondViewController *secVC = [[SecondViewController alloc] init];
secVC.number = 100;
secVC.str = self.myTextField.text;
secVC.arr = @[@"a",@"b"];
[secVC release];
}
? ?
?