- 博客(18)
- 资源 (2)
- 收藏
- 关注
转载 什么情况下用copy、assign、retain、strong...
凡是nsstring,就用copy,定义一个模型对象,就用strong,只是赋值的,例如int、double、char 以及CGRect类似的就用assign。 自己的笔记如下~ 这些关键字基本上是针对属性的set方法。 当用copy时,set方法会先release旧值,再copy一个新的对象,reference count 为1(减少了对上下文的依赖);当用assign,直接赋值,无reta
2015-08-31 17:17:22 322
转载 IOS 学习 GCD
dispatch_sync(),同步添加操作。他是等待添加进队列里面的操作完成之后再继续执行。 dispatch_queue_t concurrentQueue = dispatch_queue_create(“my.concurrent.queue”, DISPATCH_QUEUE_CONCURRENT); NSLog(@”1”); dispatch_sync(concurr
2015-08-25 16:20:41 251
原创 IOS 学习 日期选择器
(void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib.UIDatePicker *dataPicker = [[UIDatePicker alloc] init]; [dataPicker setCenter:CGPoint
2015-08-25 15:26:05 325
原创 IOS 学习 TableView
@implementation ViewController(void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib._array = [NSArray arrayWithObjects:@”Monday”,@”Tuesday”
2015-08-25 15:22:17 304
原创 IOS 学习 gei post 同步 异步方法
@implementation ViewController(void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib.// NSURL *url = [NSURL URLWithString:@”http://www.b
2015-08-25 15:17:16 344
原创 IOS 学习 多线程
1 不要同时开太多线程 1~3条2线程概念 主线程 UI线程 不要把耗时操作放在主线程 子线程 一 NSThread 1 创建和启动线程的三种方式 1)先创建 后启动 // 创建 NSThread *thread = [[NSThread alloc] initWithTarget:self selector:@selector(download:) object:nil];// 启动
2015-08-25 15:08:14 306
原创 IOS 学习 PickView的使用
@interface MJViewController () pragma mark - 数据源方法/** * 一共有多少列 */ - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { return self.foods.count; }/** * 第component列显示多
2015-08-25 15:07:28 329
原创 IOS 学习 UIWebView的用法
(void)viewDidLoad { [super viewDidLoad];// 1. 确定要访问的资源——URL NSURL *url = [NSURL URLWithString:@”http://www.baidu.com“];// 2. 建立网络请求 // 提示:所有的网络访问的本质都是一个网络请求:即请求从服务器获取某一个资源 // 因此在网络访问中,指定了要访问的资源地址之
2015-08-25 15:06:07 289
原创 IOS 学习 自动换行与去除分割线
自动换行 textView.titleLabel.numberOfLines = 0; 去除分割线 self.tableView.backgroundColor = [UIColor colorWithRed:235/255.0 green:235/255.0 blue:235/255.0 alpha:1.0]; self.tableView.separatorStyle =
2015-08-25 15:04:21 221
原创 IOS 学习 创建主TabBar
// 1.添加自己的tabbar MJTabBar *myTabBar = [[MJTabBar alloc] init]; myTabBar.delegate = self; myTabBar.frame = self.tabBar.bounds; [self.tabBar addSubview:myTabBar];// 2.添加对应个数的按钮for (i
2015-08-25 15:01:34 222
原创 IOS 学习 实现一个图片轮播器
define MJImageCount 5import “MJViewController.h”@interface MJViewController () @property (weak, nonatomic) IBOutlet UIScrollView *scrollView; @property (weak, nonatomic) IBOutlet UIPageControl *page
2015-08-25 15:00:33 287
原创 IOS 学习 创建表格的方法
pragma mark - 数据源方法/** * 一共有多少组数据 */ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // NSLog(@”numberOfSectionsInTableView-一共有多少组数据”); return 2; }/** * 第section
2015-08-25 14:59:39 300
原创 IOS 学习 数据库操作实例
// 0.定义数组 NSMutableArray *students = nil;// 1.定义sql语句const char *sql = "select id, name, age from t_student;";// 2.定义一个stmt存放结果集sqlite3_stmt *stmt = NULL;// 3.检测SQL语句的合法性int result = sqlite3_pr
2015-08-25 14:58:48 368
原创 IOS 学习 打开数据库的方法
(void)initialize { // 0.获得沙盒中的数据库文件名 NSString *filename = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@”student.sqlit
2015-08-25 14:56:14 355
原创 IOS 学习 模型初始化的方法
(instancetype)questionWithDict:(NSDictionary *)dict { return [[self alloc] initWithDict:dict]; }(instancetype)initWithDict:(NSDictionary *)dict { if (self = [super init]) {} return self; }
2015-08-25 14:53:50 1034
原创 IOS 学习 执行动画
[UIView animateWithDuration:0.25 animations:^{ // 3.1.阴影慢慢显示出来 cover.alpha = 0.7; // 3.2.头像慢慢变大,慢慢移动到屏幕的中间 CGFloat iconW = self.view.frame.size.width; CGFloat iconH = iconW
2015-08-25 14:52:44 304
原创 IOS 学习记录 表格单元格放入缓存池
(instancetype)cellWithTableView:(UITableView *)tableView { static NSString *ID = @”tg”; MJTgCell *cell = [tableView dequeueReusableCellWithIdentifier:ID]; if (cell == nil) { // 从xib中加载cell
2015-08-25 14:41:15 284
原创 IOS 学习 字典转模型
IOS 学习记录 字典转模型(NSMutableArray *)tgs { if (_tgs == nil) { // 初始化 // 1.获得plist的全路径 NSString *path = [[NSBundle mainBundle] pathForResource:@”tgs.plist” ofType:nil];// 2.加载数组NSArray *di
2015-08-25 14:36:58 285
C语言教程讲义(谭浩强).
2011-11-25
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人