- 博客(42)
- 收藏
- 关注
转载 在导航视图控制器加多个标题
//标题 NSArray *segmentedArray = [[NSArray alloc]initWithObjects:@”头条”,@”Apple”,@”直播”,@”测评”,@”新闻”,@”手机”, nil];self.segmentControl = [[UISegmentedControl alloc]initWithItems:segmentedArray];self.segm
2015-08-24 08:45:04
436
转载 网络请求数据
import “MainViewController.h”import “Movie.h”import “MBProgressHUD.h”@interface MainViewController ()
2015-08-17 21:02:58
375
转载 block
block的属性使用copy的解释 block作为属性的时候,为了防止block进入到栈区,栈区内存不需要我们进行管理,很可能出现block消失的情况,所以要拷贝一份到堆区,这样能防止block在用的时候消失block的release方法 Block_release(_block);
2015-08-12 17:37:42
397
转载 block传值
block传值import “MainViewController.h”import “SecondViewController.h”@interface MainViewController ()import “SecondViewController.h”import “MainViewController.h”@interface SecondViewController () @prope
2015-08-12 17:33:35
343
转载 快捷菜单
快捷菜单 @interface FirstViewController ()pragma mark 快捷菜单捆绑了一个方法,这个方法必须实现,如果不实现,快捷菜单没有办法显示-(BOOL)canBecomeFirstResponder{ return YES; }-(void)flag{ NSLog(@”测试”); }// 系统自带的 -(void)delete:(id)
2015-08-12 17:30:59
712
转载 UITabBar
UITabBar 需要创建多个ViewControllerimport “AppDelegate.h”import “FirstViewController.h”import “TwoViewController.h”import “ThreeViewController.h”import “FourViewController.h”import “FiveViewController.h”imp
2015-08-12 17:27:34
436
转载 cell自适应高度
cell自适应高度import “MyCell.h”define WIDTH self.contentView.frame.size.widthdefine HEIGHT self.contentView.frame.size.height@implementation MyCell-(instancetype)initWithStyle:(UITableViewCellStyle)style re
2015-08-11 17:12:03
478
转载 带分区的省市区
带分区的省市区import “MainViewController.h”define WIDTH self.view.frame.size.widthdefine HEIGHT self.view.frame.size.height@interface MainViewController ()warning 如果在初始化方法里使用self.view,此时还没有创建self.view,系统会自动调用
2015-08-11 17:09:53
571
转载 tableView的编辑
tableView的编辑import “MainViewController.h”@interface MainViewController ()pragma mark 重写系统的编辑按钮点击触发的方法-(void)setEditing:(BOOL)editing animated:(BOOL)animated{ [super setEditing:editing animated:ani
2015-08-11 17:07:49
528
转载 自定义cell
自定义cellimport “MainViewController.h”import “MyCell.h”import “BetterCell.h”import “Student.h”define WIDTH self.view.frame.size.widthdefine HEIGHT self.view.frame.size.height@interface MainViewController
2015-08-11 08:45:02
287
转载 tableView联动
tableView联动import “MainViewController.h”define WIDTH self.view.frame.size.widthdefine HEIGHT self.view.frame.size.height@interface MainViewController ()
2015-08-11 08:31:49
341
转载 TableView界面传值
TableView界面传值import import “SecondViewController.h”@interface SecondViewController () @property(nonatomic,retain)UILabel *label; @property(nonatomic,retain)UITextField *textField; @property(nonatomi
2015-08-07 18:45:32
722
转载 UITableView
UITableViewimport “MainViewController.h”import “SecondViewController.h”@interface MainViewController ()pragma mark tableView第一个必须实现的协议方法,指定分区内有多少行-(NSInteger)tableView:(UITableView *)tableView numberOf
2015-08-07 18:40:38
354
转载 界面传值(协议)
界面传值(协议)import import “SecondViewController.h”@interface SecondViewController () @property(nonatomic,retain)UIButton *button; @property(nonatomic,retain)UITextField *textField;@end@implementation Sec
2015-08-06 20:27:35
329
转载 导航视图控制器及其属性传值
导航视图控制器及其属性传值import “MainViewController.h”import “SecondViewController.h”@interface MainViewController ()@end@implementation MainViewController(void)dealloc { [_textField release]; [super dealloc];
2015-08-06 20:24:25
411
转载 循环滚动图片
循环滚动图片import “MainViewController.h”define WIDTH self.view.frame.size.widthdefine HEIGHT self.view.frame.size.height@interface MainViewController ()@end@implementation MainViewController(void)viewDidLo
2015-08-05 19:58:59
408
转载 UIPageControl
UIPageControlimport “MainViewController.h”define WIDTH self.view.frame.size.widthdefine HEIGHT self.view.frame.size.height@interface MainViewController () @property(nonatomic,retain)UIScrollView *scro
2015-08-05 19:55:37
390
转载 UIScrollview
UIScrollviewimport “MainViewController.h”define WIDTH self.view.frame.size.widthdefine HEIGHT self.view.frame.size.height@interface MainViewController ()@end@implementation MainViewController(void)vie
2015-08-05 19:52:05
307
转载 UISegmentedControl
NSArray *segmentedArr=[[NSArray alloc] initWithObjects:@”1”,@”2”,@”3”,@”4”, nil]; UISegmentedControl *segmented=[[UISegmentedControl alloc] initWithItems:segmentedArr]; segmented.frame=CGRect
2015-08-04 17:38:04
358
转载 UIStepper
UIStepper(可以控制一些变化) UIStepper *stepper=[[[UIStepper alloc] initWithFrame:CGRectMake(100, 500, 175, 50)] autorelease]; [self.view addSubview:stepper]; [stepper release]; [stepper addTarg
2015-08-04 17:27:02
421
转载 手势识别器
import “MainViewController.h”@interface MainViewController () @property(nonatomic,retain)UIImageView *imageView; @property(nonatomic,assign)BOOL isSelect; @property(nonatomic,retain)UIAlertView *alt
2015-08-04 17:23:52
384
转载 UISwitch
UISwitch UISwitch *mySwitch=[[UISwitch alloc] initWithFrame:CGRectMake(100, 100, 175, 100)]; [self.view addSubview:mySwitch]; // 设置初始化状态 mySwitch.on=YES; // 设置初始为ON的一边 [mySwitch re
2015-08-03 17:54:43
311
转载 delegate
delegateimport import “MyButton.h”@implementation MyButton-(void)touchesBegan:(NSSet )touches withEvent:(UIEvent )event{ // 3.设置代理人执行的方法 [self.delegate changeColor]; } @endimport “MainViewC
2015-08-03 17:52:09
295
转载 Target-Action
Target-Actionimport import “MyButton.h”@implementation MyButton // 3.自定义的方法实现 -(void)addnewTarget:(id)target Action:(SEL)action{ self.target=target; self.action=action; } // 4.设置一个点击的触发条件
2015-08-03 17:48:14
358
转载 Touch
Touch(触摸,摇一摇) 触摸(touches) 摇一摇(motion) 移动视图 MainViewController.m // 创建一个MyView MyView *myView=[[MyView alloc] initWithFrame:CGRectMake(100, 200, 175, 100)]; myView.backgroundColor=[UICol
2015-08-03 17:37:27
405
转载 UIViewController视图控制器
UIViewController视图控制器import “AppDelegate.h”import “RootViewController.h”@interface AppDelegate ()@end@implementation AppDelegate(void)dealloc { [_window release]; [super dealloc]; }(BOOL)applicat
2015-07-31 16:59:21
242
转载 LTView
LTViewimport “LTView.h”@implementation LTView// 重写init默认的初始化方法 -(instancetype)initWithFrame:(CGRect)frame{ self=[super initWithFrame:frame]; if (self) { // 模块化 [self create
2015-07-31 16:51:50
286
转载 UIButton和UITextField
UIButton和UITextFieldimport “AppDelegate.h”@interface AppDelegate ()@property(nonatomic,retain)UITextField *textField; @property(nonatomic,assign)BOOL isSelect; @property(nonatomic,retain)UILabel *lab
2015-07-31 08:54:24
319
转载 UITextField
UITextFieldimport “AppDelegate.h”@interface AppDelegate ()@end@implementation AppDelegate-(void)dealloc{ [_window release]; [super dealloc]; }(BOOL)application:(UIApplication )application d
2015-07-31 08:51:15
290
转载 UIButton
UIButtonimport “AppDelegate.h”@interface AppDelegate ()@property(nonatomic,assign)BOOL isSelected; @property(nonatomic,assign)BOOL isClick;@end@implementation AppDelegate-(void)dealloc{ [_window
2015-07-31 08:48:19
235
转载 UILabel
UILabel // 设置文本内容 label.text=@”你好,我的名字叫张三,哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈!!!!”; // 文本内容的颜色 label.textColor=[UIColorblackColor]; // 文本的对齐方式 // 默认是居左,textAlignm
2015-07-31 08:46:40
284
转载 UIView
UIViewimport “AppDelegate.h”// 宏define WIDTH self.window.frame.size.widthdefine HEIGHT self.window.frame.size.height@interface AppDelegate ()@property(nonatomic,retain)UIView *myView;@end@implementatio
2015-07-31 08:44:00
303
转载 Block,多态,数组排序
1.回忆C语言中5大区的地址 (1)栈区 int a=10; NSLog(@”%p”,&a); 2015-07-28 19:06:00.999 OC10_Block[3922:303] 0x7fff5fbff85c (2)堆区 int *p=malloc(40); NSLog(@”%p”,p); 2015-07-28 19:06:01.001 OC10_Block[3922:303]
2015-07-28 20:32:05
461
转载 内存管理
// 管理内存有三种方法 // 一:垃圾回收,java常见的管理内存的方法,系统来检测对象是否被使用,是否被释放 // 二:MRC手动管理引用计数,iOS管理内存的方式,程序员通过手动方式来管理对象是否被释放 // 三:ARC自动管理引用计数,基于MRC,系统自动的管理内存,以后我们还是先使用MRC,培养管理内存的习惯1. 对象被创建出来之后它的引用计数retainC
2015-07-27 19:54:06
290
转载 延展,类目,协议
1.延展(延展一般在.h文件中#import和@interface之间写) // 延展以@interface开头,然后写当前延展的类名,类名后加一个(),到@end结束 // 一般延展会写在自己写的.m文件中,把一些不想让外部调用的属性放在延展里,这样这条属性只能在类的内部使用,外部使用不了,尽最大可能保护当前类的安全 // 类目一般都是给看不见.m的系统文件进行扩展,延展一般是针对自己的类进
2015-07-25 09:09:40
351
转载 省市区字典
// 准备工作 NSString *path=@”/Users/dlios/Desktop/内容/OC06_省市区字典数组/OC06_省市区字典数组/area.txt”; // 跟据路径产生相应字符串 NSString *str=[NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding e
2015-07-23 19:58:42
2115
转载 迭代器,值对象,日期集合
1.迭代器 (1) NSArray *arr=@[@”1”,@”2”,@”3”,@”4”]; NSEnumerator *enumerator=[arr objectEnumerator]; NSString *str=nil; while (str=[enumerator nextObject]) { NSLog(@”%@”,str); } 2015-07-23 17:26:
2015-07-23 18:00:14
328
转载 字典
1.创建字典对象// 自定义创建字典NSDictionary *dic=[[NSDictionary alloc] init]; // 创建一个空字典 NSDictionary *dic=[NSDictionary dictionary]; NSDictionary *dic=[[NSDictionary alloc] initWithObjectsAndKeys:@”1”,@”2”,@”3”
2015-07-22 19:25:42
321
转载 数组
// OC里的数组 // OC的数组里存放的一定是对象 1.字面量NSArray *arr=@[@"1",@"2",@"3",@"4",@"5"];// count:数组的元素个数NSLog(@”%ld”,arr.count); // 取值也是通过下标来取值,返回一个对象 NSLog(@”%@”,[arrobjectAtIndex:3]); NSLog(@”%@”
2015-07-21 20:49:30
328
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅