1.調用電話,調用短信,調用自帶瀏覽器
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.baidu.com"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://110:234234234"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://10086"]];
2.調用相冊 使用圖片
"(void) buttonAction:(UIButton * )sender
{
UIImagePickerController * imageController= [[UIImagePickerController alloc]init];
imageController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; // 從相冊中拿.
imageController.delegate = self;
[self presentViewController:imageController animated:YES completion:^{
NSLog(@""訪問相冊"");
}];
}"
"(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
NSLog(@""%@"",info); // 這里的 info 取第二個,就是哪個經過修改后的圖片,選擇完成后,推出模態.
}"
3.UIAlertController
(void)viewDidLoad {
[super viewDidLoad];
// 第一步:這里安排一個按鈕.一點擊就彈出模態的 alertVIew.
self.view.backgroundColor = [UIColor greenColor];
self.button = [UIButton buttonWithType:(UIButtonTypeSystem)];
_button.frame = CGRectMake(100,100, 100, 100);
_button.backgroundColor = [UIColor purpleColor];
[self.view addSubview:_button];
[_button addTarget:self action:@selector(buttonAction:) forControlEvents:(UIControlEventTouchUpInside )];
// 第二步 : 設置提示框.
self.alertVC = [UIAlertController alertControllerWithTitle:@"提示" message:@"沒有輸入名字" preferredStyle:UIAlertControllerStyleAlert];
// 第四步,可以從彈出來的模態哪個對話框中添加 textfiled. 用戶可以輸入一些東西,比如用戶名什么的.
[_alertVC addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"請輸入名字";
}];
[_alertVC addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"請輸入密碼";
textField.secureTextEntry = YES;
}];
// 第五步 :也可以在下面添加按鈕.并且以 block 的方式實現處理方法.
UIAlertAction * action1 = [UIAlertAction actionWithTitle:@"取消" style:(UIAlertActionStyleCancel) handler:nil];
UIAlertAction * action2 = [UIAlertAction actionWithTitle:@"確定" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction *action) {
NSLog(@"開始判定賬號密碼:");
}];
[_alertVC addAction:action1];
[_alertVC addAction:action2];
}
-(void) buttonAction:(UIButton * )sender
{
// 第三步:點擊按鈕,觸發彈出模態.里面有UIalertController 控制器.注意這里不是 show, 從8.0以后才有的這個控件.
NSLog(@"點擊了 button, 彈出了 alert1");
[self presentViewController:_alertVC animated:YES completion:nil];
}
4.加速計,磁力針,陀螺儀。
5.程序間的通信,兩個程序相互跳轉
6.UISearchBar和 UISearchDisplayController的使用 + 謂詞
" UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)];
searchBar.placeholder = @""搜索"";
[searchBar sizeToFit];
searchBar.searchBarStyle = UISearchBarStyleProminent;
// 添加 searchbar 到 headerview
// self.chatTableView.tableHeaderView = searchBar;
// 用 searchbar 初始化 SearchDisplayController
// 并把 searchDisplayController 和當前 controller 關聯起來
self.searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self];
// searchResultsDataSource 就是 UITableViewDataSource
searchDisplayController.searchResultsDataSource = self;
// searchResultsDelegate 就是 UITableViewDelegate
searchDisplayController.searchResultsDelegate = self;"
7.webView
8.git :本地的版本控制.版本回滾.2.下代碼
9.cocopods
gem sources --remove https://tubygems.org/
gem sources -a http://ruby.taobao.org/
sudo gem install cocoapods
pod search AFNetworking // 搜索庫,名字是 AFNetworking
"platform :ios,'8.0'
pod 'AFNetworking', '~> 2.5.4'
pod 'Reachability', '~> 3.2'
pod 'FMDB', '~> 2.5'
pod 'LeanCloud', '~> 3.1.0'
pod 'SDWebImage', '~> 3.7.3'
pod 'shareSDK', '~> 0.0.2'
pod 'MagicalRecord', '~> 2.3.0'
pod 'MBProgressHUD', '~> 0.9.1'
pod 'EGOTableViewPullRefresh', '~> 0.1.0'"
10.learncloud
// 創建
AVObject *obj2 = [AVObject objectWithClassName:@"One"];
// 添加
[obj2 setObject:@"Nihao" forKey:@"greet"];
[obj2 setObject:@(34) forKey:@"age"];
NSLog(@"%@",obj2.objectId);
// 保存/上傳
[obj2 save]; // 同步的
[obj2 saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if (succeeded) {
NSLog(@"數據上傳成功");
}
else
{
NSLog(@"上傳失敗");
}
}];
// 下載
AVQuery * query = [AVQuery queryWithClassName:@"One"];
AVObject * obj3 = [query getObjectWithId:@"55a8ed8ce4b086039dd174f3"];
NSLog(@"%@",[obj3 objectForKey:@"greet"]);
AVUser * nowUser = [AVUser currentUser];
NSLog(@"%@",nowUser);
[AVUser logOut];
nowUser = [AVUser currentUser];
NSLog(@"%@",nowUser);
// 創建用戶
AVUser * user = [AVUser user];
user.username = @"Lucidy";
user.password = @"123456";
user.mobilePhoneNumber = @"15652805835";
// 用戶登錄.
[user signUpInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if (succeeded) {
NSLog(@"注冊成功");
}
else
{
NSLog(@"注冊失敗:%@",error);
}
}];
// 更改登錄用戶
AVUser * NewUser = [AVUser logInWithUsername:@"Lucidy" password:@"123456" error:nil];
NSLog(@"%@",NewUser);
11.reachability
12.sdwebimage