文章分类 -  A1-iphone

摘要://公共函数//.h+ (UIView *) changeNavTitleByFontSize:(NSString *)strTitle;//.m+ (UIView *) changeNavTitleByFontSize:(NSString *)strTitle{ //自定义标题 UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0 , 100, 44)]; titleLabel.backgroundColor = [UIColor clearColor]; titleLabel.fon... 阅读全文
posted @ 2013-10-28 14:24 暖流 阅读(3030) 评论(0) 推荐(0)
摘要:1,首先//定义宏,判断ios7#define IOS7 [[[UIDevice currentDevice]systemVersion] floatValue] >= 7.0//添加代码if (IOS7){ self.edgesForExtendedLayout = UIRectEdgeNone; //视图控制器,四条边不指定 self.extendedLayoutIncludesOpaqueBars = NO; //不透明的操作栏 self.modalPresentationCapturesStatusBarAp... 阅读全文
posted @ 2013-09-26 09:39 暖流 阅读(26887) 评论(0) 推荐(2)
摘要:UIImageView *imageView =[[UIImageView alloc]initWithFrame:CGRectMake(100, 100, 200, 200)]; imageView.image=[UIImageimageNamed:@"filter_laozhaopian_a.png"];imageView.userInteractionEnabled = YES;UITapGestureRecognizer *singleTap = [[UITapGestureRecognizeralloc] initWithTarget:selfaction:@se 阅读全文
posted @ 2013-09-23 16:34 暖流 阅读(833) 评论(0) 推荐(1)
摘要://初始化,将lab添加进入一个Img UIImage *img = [[UIImage imageNamed:@"timeline_new_status_background.png"] stretchableImageWithLeftCapWidth:5 topCapHeight:5]; _barView = [[UIImageView alloc] initWithImage:img]; _barView.frame = CGRectMake(5, -40, 320-10, 40); [self.view addSubview:_b... 阅读全文
posted @ 2013-09-18 17:05 暖流 阅读(275) 评论(0) 推荐(0)
摘要:1.objective-c中的数字对象都有哪些,简述它们与基本数据类型的区别是什么2.用NSLog函数输出一个浮点类型,结果四舍五入,并保留一位小数3.截取字符串”20|http://www.621life.com“ 中 ‘|’字符前面及后面的数据,分别输出它们4.objective-c中的词典对象、可变词典对象是哪个,初始化一个含有两个键值对的可变词典对象,并动态的添加和删除一条记录,输出第一条记录5.获取项目根路径,并在其下创建一个名称为userData的目录。6.在一个对象的方法里面:self.name = “object”;和name =”object”有什么不同吗?7.定义属性时,什 阅读全文
posted @ 2012-07-26 14:00 暖流 阅读(1036) 评论(0) 推荐(0)
摘要:1、调用 自带mail[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://admin@hzlzh.com"]];2、调用 电话phone[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8008808888"]];3、调用 SMS[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@&quo 阅读全文
posted @ 2012-07-25 11:42 暖流 阅读(40239) 评论(5) 推荐(1)
摘要:类A.h: 1 @protocol ADelegate <NSObject> 2 3 -(void)babyAdded:(Baby*)newBaby; 4 -(void)babyChanged:(Baby*)changedBaby; 5 6 @end 7 @interface A : UIViewController<UITextFieldDelegate> 8 9 @property(nonatomic,strong) id<ADelegate> delegate;10 11 @end首先在A中定义了一个代理ADelegate,代理中有两个方法,并且定义了 阅读全文
posted @ 2012-07-11 17:19 暖流 阅读(361) 评论(0) 推荐(0)
摘要://初始化一个buttonUIButton *defaultIcon =[[UIButton alloc] initWithFrame:CGRectMake(230, 10, 23, 23)];//为其添加tag,绑定响应事件到相应的函数[defaultIcon addTarget:defaultBabyIconTag action:@selector(clickChangeBaby) forControlEvents:UIControlEventTouchUpInside];[cell addSubview:defaultIcon]; 阅读全文
posted @ 2012-07-10 17:57 暖流 阅读(395) 评论(0) 推荐(0)
摘要:使用空白view取代cell- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ //取消选中颜色 UIView *backView = [[UIView alloc] initWithFrame:cell.frame]; cell.selectedBackgroundView = backView; cell.selectedBackgroundView.backgroundColor = [UIColor clearColor];... 阅读全文
posted @ 2012-07-03 10:52 暖流 阅读(19853) 评论(2) 推荐(1)
摘要:在iOS中,一个UIResponder对象表示一个可以接收触摸屏上的触摸事件的对象,通俗一点的说,就是表示一个可以接收事件的对象。 iOS中,所有显示在界面上的对象都是从UIResponder直接或间接继承的。下面是UIResponder类的一些定义信息:触摸事件相关:方法名称说明touchesBegan:withEvent当用户触摸到屏幕时调用方法tochesMoved:withEvent当用户触摸到屏幕并移动时调用此方法tochesEnded:withEvent当触摸离开屏幕时调用此方法tochesCancelled:withEvent当触摸被取消时调用此方法运动事件相关:运动事件是指当用 阅读全文
posted @ 2012-06-18 15:47 暖流 阅读(2161) 评论(0) 推荐(0)
摘要:#import "LabelTestViewController.h" @implementation LabelTestViewController /* Accessing the Text Attributes text property font property textColor property textAlignment property lineBreakMode property enabled property Sizing the Label’s Text ad... 阅读全文
posted @ 2012-06-14 02:37 暖流 阅读(277) 评论(0) 推荐(0)
摘要:在iPhone开发中,每当视图准备在屏幕上显示或者视图已在屏幕上完全显示时将调用这两个方法。viewWillApperar---更新准备显示得视图信息,调用时视图可能还没有被加载。ViewDidApper---来触发视图完全显示在屏幕上之后得行为,切换视图会被调用viewWillAppear:Called when the view is about to made visible. Default does nothing视图即将可见时调用。默认情况下不执行任何操作viewDidAppear:Called when the view has been fully transitioned o 阅读全文
posted @ 2012-06-08 17:35 暖流 阅读(436) 评论(0) 推荐(0)
摘要:Interface Builder是一个用户界面工具,功能强大。Interface Builder与其他一些界面工具最大区别是,它不直接产生代码。Interface Builder直接生成的是.xib(以前叫.nib)文件(按惯例我就叫它nib文件),它将你的界面以object的形式存存储在文件中。我们知道每 个iPhone(Xcode)项目都有一个.plist文件,其中有一项叫做“Main nib file base name”,它指向了程序启动时要调用的nib文件MainWindow.xib。总而言之,每个OC的程序都像c或c++一样有一个main函数,它是整个程序的入口(在main.m中 阅读全文
posted @ 2012-06-04 11:45 暖流 阅读(681) 评论(0) 推荐(0)
摘要:@synthesize window = _window;这样定义,使用的时候必须[[self window] setText:@"xxx"]加上self才行,或者self.window.text = @"xxx";@synthesize window;这样定义,就可以[window setText:@"xxx"]或者window.text = @"xxx";@synthesize window=_window; 意思是说,window 属性为 _window 实例变量合成访问器方法。iphone上的程序的运行时就 阅读全文
posted @ 2012-05-31 10:50 暖流 阅读(285) 评论(0) 推荐(0)
摘要:File's Owner 表示视图控制器。用来关联 IB 中的 outlet (textfield, label)与实例变量(library classes 中定义)的关联。First Responder 表示当前响应用户触摸的屏幕上的对象。在应用程序生命周期内, First Responder 在用户与屏幕交互时变化。例如,假设有一个表单。当用户触摸表单中的某个文本域时,那个文本域将成为活动文本域,并担当 First Responder 的角色。*** 在一个事件相应的最后为什么要加上这句? ****[field2 resignFirstResponder];Notifies the 阅读全文
posted @ 2012-05-30 16:05 暖流 阅读(255) 评论(0) 推荐(0)
摘要:init方法在init方法中实例化必要的对象(遵从LazyLoad思想)‍init方法中初始化ViewController本身loadView方法当view需要被展示而它却是nil时,viewController会调用该方法。不要直接调用该方法。如果手工维护views,必须重载重写该方法如果使用IB维护views,必须不能重载重写该方法loadView和IB构建view你在控制器中实现了loadView方法,那么你可能会在应用运行的某个时候被内存管理控制调用。 如果设备内存不足的时候, view 控制器会收到didReceiveMemoryWarning的消息。 默认的实现是检查当前控制器的v 阅读全文
posted @ 2012-05-30 11:31 暖流 阅读(441) 评论(0) 推荐(0)
摘要:StoryBoard是iOS 5的新特征,旨在代替历史悠久的NIB/XIB。以往的XIB的使用方法是一个viewController对应一个nib文件。StoryBoard的最大作用就是把这些nib文件组织起来,放在一个文件里[MainStoryBoard.storyboard],同时在此文件里面提供了不同试图间的切换。有人可能会担心,一次加载所有试图,对内存压力会比较大。这个问题是不存在的,虽然视图都在一个文件里,但是编译的时候会把StoryBoard里面的文件分开,程序运行到的部分才会被加载。StoryBoard里一个重要的概念是scene。StoryBoard里一个viewControl 阅读全文
posted @ 2012-05-30 11:28 暖流 阅读(3788) 评论(0) 推荐(0)