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