- 博客(34)
- 收藏
- 关注
原创 URL 简介
什么事URL?URL的全称是Uniform Resource Locator (统一资源定位符)通过一个URL,能找到互联网上唯一的一个资源URL就是资源的地址、位置,互联网上的每个资源都有一个唯一的URLURL的基本格式 = 协议://主机地址/路径协议:不同的协议,代表着不同的资源查找方式、资源传输方式主机地址:存放资源的主机IP地址(域名)路径:资源在主机
2016-01-14 23:06:39
301
原创 iOS 自定义库文件
第一步:创建framworking工程第二步在工程里封装一个自定义类;#import @interface imageview :UIImageView-(instancetype)initWithFrame:(CGRect)frame urlString:(NSString *)_urlString;@end#impor
2016-01-14 17:07:15
296
原创 UITabBarController2
//调用init方法时自动调用-(instancetype)init{ self=[super init]; if (self) { self.navigationItem.title=@"首页"; //设置tabbar的类型 UITabBarItem *taitem=[[UITabBarItem alloc]initW
2016-01-12 22:50:24
216
原创 UITabBarController
oneViewController *onev=[[oneViewController alloc]init]; UINavigationController *nav1=[[UINavigationController alloc]initWithRootViewController:onev]; twoViewController *twov=[[twoView
2016-01-12 22:49:56
187
原创 UISwitch
myswitch=[[UISwitch alloc]initWithFrame:CGRectMake(100, 100, 100, 100)]; [myswitch setOnTintColor:[UIColor purpleColor]]; //ios6可以使用// [myswitch setOffImage:[UIImage imageNamed:@"home"
2016-01-12 22:49:27
213
原创 UISlider
mysilider=[[UISlider alloc]initWithFrame:CGRectMake(0, 500, width, 300)]; mysilider.value=0.1;// mysilider.maximumValueImage=[UIImage imageNamed:@""];// mysilider.minimumValueImage=[UII
2016-01-12 22:48:51
225
原创 UISegmentedControl(分段控制器)
mysegmen=[[UISegmentedControl alloc]initWithItems:@[@"one",@"two",@"three"]]; mysegmen.frame=CGRectMake(100, 100, 200, 60); //初始位置 mysegmen.selectedSegmentIndex=1; mysegmen.tintCol
2016-01-12 22:48:20
306
原创 UIProgressView(进度条)
//创建一个进度条 myprogress=[[UIProgressView alloc]initWithFrame:CGRectMake(0, 300, self.view.frame.size.width, 30)]; //进度条的类型 myprogress.progressViewStyle=UIProgressViewStyleBar; //为进度条添
2016-01-12 22:47:46
494
原创 UIPickerView(选择框)
dic=@{@"xian":@[@"a",@"b",@"c"],@"hangzhou":@[@"d",@"e",@"f"],@"wuhan":@[@"g",@"h",@"z"]}; NSString *path=[[NSBundle mainBundle]pathForResource:@"cities" ofType:@"plist"]; arry1=[[NSMutableA
2016-01-12 22:47:03
415
原创 UIScrollView(滑动视图)
//设置一个scrollview给他大小(容器) UIScrollView *myscroll=[[UIScrollView alloc]initWithFrame:self.view.frame]; myscroll.backgroundColor=[UIColor blackColor]; UIImage *img=[UIImage imageName
2016-01-12 22:46:27
225
原创 UIAlertController
-(IBAction)hahah:(id)sender{ UIAlertController *alertc=[UIAlertController alertControllerWithTitle:@"网络设置" message:@"message" preferredStyle:UIAlertControllerStyleAlert]; //添加密码框
2016-01-12 22:45:45
356
原创 UIPageControl
UIPageControl类提供一行点来指示当前显示的是多页面视图的哪一页。当然,由于UIPageControl类可视样式的点击不太好操作,所以最好是确保再添加了可选择的导航选项,以便让页面控件看起来更像一个指示器,而不是一个控件。当用户界面需要按页面进行显示时,使用UIPageControl控件将要显示的用户界面内容分页进行显示会使编程工作变得快捷。UIPageControl *
2016-01-12 22:45:05
181
原创 UIActionSheet
UIActionSheet是在iOS弹出的选择按钮项,可以添加多项,并为每项添加点击事件。-(IBAction)sheetshow:(id)sender{ UIActionSheet *sheetnow=[[UIActionSheet alloc]initWithTitle:@"相片设置功能" delegate:self cancelButtonTitle:@"取消" d
2016-01-12 22:44:27
391
原创 UIAlertView(警告提示)
-(IBAction)showPhonenum:(id)sender{ UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"请您检测网络" message:@"在手机设置里面->通用->网络" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
2016-01-12 22:43:51
383
原创 UINavigationController(导航控制器)
myViewController *myv=[[myViewController alloc]init]; //创建导航控制器并且添加根视图 UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:myv]; self.window.rootViewCo
2016-01-12 22:43:18
320
原创 UIView
self.view.backgroundColor=[UIColor orangeColor]; UIView *v1=[[UIView alloc]initWithFrame:CGRectMake(100, 100, 200, 200)]; v1.backgroundColor=[UIColor purpleColor]; [self.view addSubview
2016-01-12 22:42:46
159
原创 UITextField(文本输入框)
//编辑一个用户名输入框 mytextfield_name=[[UITextField alloc]initWithFrame:CGRectMake(100, 100, 200, 60)]; mytextfield_name.tag=99; mytextfield_name.placeholder=@"请输入用户名"; mytextfield_name.au
2016-01-12 22:42:08
218
原创 UIActivityIndicatorView(菊花)
myactivity = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; myactivity.backgroundColor=[UIColor grayColor]; //设置他的位置到center
2016-01-12 22:41:33
350
原创 数据库操作
//增加一个tabelNSString *path=[NSHomeDirectory() stringByAppendingString:@"/Documents/mydata.sqlite"]; NSLog(@"%@",NSHomeDirectory()); db=[FMDatabase databaseWithPath:path];NSString *sql
2016-01-12 22:40:17
224
原创 SQL语句种类
数据定义语句(DDL:Data Definition Language)包括create和drop等操作在数据库中创建表或删除表(create table或drop table)数据操作语句(DML:Data Manipulation Language)包括insert、update、delete等操作上面的三种作用分别用于添加、修改、产出表中数据
2016-01-12 22:39:30
289
原创 iOS 自带的高德地图
#import "ViewController.h"#import "bubber.h"@interface ViewController (){ MKMapView *mymapview; CLLocationManager* locationcoordinate; NSArray *imgArry;}@end
2016-01-12 22:37:37
279
原创 iOS 语音
#import "ViewController.h"#import @interface ViewController ()@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad]; // Do a
2016-01-12 22:35:08
293
原创 framebounds
tale=[[UITableView alloc]initWithFrame:self.view.frame]; [self.view addSubview:tale]; UIView *buttonv=[[UIView alloc]initWithFrame:CGRectMake(100, 100, 300, 300)]; buttonv.backg
2016-01-12 22:33:56
217
原创 归档与解归档
/创建一个路径 NSString *path=[NSHomeDirectory() stringByAppendingString:@"/Documents/haha.text"]; NSLog(@"%@",NSHomeDirectory()); NSArray *arry=@[@"one",@"two",@"three"]; //归档一个数组到path路径
2016-01-12 22:33:09
197
原创 NSData (用utf8创建数据和读取数据)
NSData *data=[@"nihaoashdihahdo你好" dataUsingEncoding:NSUTF8StringEncoding]; NSLog(@"%@",data);创建数据 NSString*getstring=[[NSString alloc]initWithData:data encoding:NSUTF8StringEncodi
2016-01-12 22:32:20
404
原创 NSMutableAttributedString(带属性的string)
mylabel=[[UILabel alloc]initWithFrame:CGRectMake(0, 50, 1000, 50)]; mylabel.backgroundColor=[UIColor brownColor]; [self.view addSubview:mylabel]; NSString *string=@"welcome to china";
2016-01-12 22:30:18
386
原创 NSPredicate(谓词)
简述:Cocoa框架中的NSPredicate用于查询,原理和用法都类似于SQL中的where,作用相当于数据库的过滤取。//谓词使用 //小于条件 NSPredicate *mypredic=[NSPredicate predicateWithFormat:@"age]; //与条件 NSPredicate *predic1=[NSPredicat
2016-01-12 22:29:28
180
原创 Font
UILabel *mylabel=[[UILabel alloc]initWithFrame:CGRectMake(100, 100, 300, 60)]; mylabel.text=@"你好"; [self.view addSubview:mylabel];//设置字体大小 mylabel.font=[UIFont systemFontOfSize:30];
2016-01-12 22:28:36
316
原创 NSNotification (通知)
- (void)viewDidLoad { [super viewDidLoad];//创建一个通知中心 [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(hahah:) name:@"notification" object:nil]; }//通知将会触发的方
2016-01-12 22:27:31
272
原创 UIButton
//用代码创建一个button; mysetbutton=[[UIButton alloc]initWithFrame:CGRectMake(0, 100, 200, 100)]; [mysetbutton setTitle:@"来自代码的button" forState:UIControlStateNormal]; [mysetbutton setTitle:@"
2016-01-12 22:26:36
161
原创 iOS 动画
NSMutableArray *arrimg=[NSMutableArray arrayWithCapacity:6]; for (int i=1; i NSString *imgname=[NSString stringWithFormat:@"%d.jpg",i]; UIImage *image=[UIImage imageNamed:imgnam
2016-01-12 22:25:48
163
原创 iOS UIImageView
//获取本地图片 UIImageView *imgV=[[UIImageView alloc]initWithFrame:self.view.frame]; UIImage *imge=[UIImage imageNamed:@"456.jpg"]; imgV.image=imge; [self.view addSubview:imgV]; //获
2016-01-12 22:24:27
204
原创 iOS nsdate
//获取时间 NSDate *mydate=[NSDate date];//创建时间格式 NSDateFormatter *mydateFormatter=[[NSDateFormatter alloc]init]; [mydateFormatter setDateFormat:@"yyyy-MM-dd:HH:mm:ss:SSS"];//得到正确格式的时间
2016-01-12 22:23:49
173
原创 NSFileManager的简介和使用
通过使用NSFileManager类来管理和操作文件、目录,NSFileManager,文件或目录是使用文件的路径名的唯一标示。每个路径名都是一个NSString对象。 NSFileManager对象通过defaultManager方法来创建实例 NSString *path1=[NSHomeDirectory() stringByAppendingPathComponent:@"Doc
2016-01-12 22:15:43
235
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅