摘要: 在ios4.0及以后鼓励使用animateWithDuration方法来实现动画效果。当然,以往的begin/commit的方法依然使用,下面详细解释一下animateWithDuration的使用方法。函数原型:+ (void)animateWithDuration:(NSTimeInterval... 阅读全文
posted @ 2015-04-16 10:57 代佳宏 阅读(372) 评论(0) 推荐(0) 编辑
摘要: 所有编程语言的单例模式都大同小异。Object-c, Java, C++等,跟语言没有太大关系,只跟语法有点关系而己。在IOS 中假如你有一个类:AccountManager,你要定义单例则步法如下:一. 在.h文件中应该有类似如下定义:+ (id) sharedInstance; 二. 在.m... 阅读全文
posted @ 2015-04-15 11:57 代佳宏 阅读(114) 评论(0) 推荐(0) 编辑
摘要: bundle是一个目录,其中包含了程序会使用到的资源. 这些资源包含了如图像,声音,编译好的代码,nib文件(用户也会把bundle称为plug-in). 对应bundle,cocoa提供了类NSBundle.我们的程序是一个bundle. 在Finder中,一个应用程序看上去和其他文件没有什么区别... 阅读全文
posted @ 2015-01-19 16:06 代佳宏 阅读(175) 评论(0) 推荐(0) 编辑
摘要: #import "ViewController.h"@import MediaPlayer;@interface ViewController (){ MPMoviePlayerController *_mov;}@property (weak, nonatomic) IBOutlet UIImag... 阅读全文
posted @ 2015-01-15 12:01 代佳宏 阅读(155) 评论(0) 推荐(0) 编辑
摘要: CAEmitterLayer *snowEmitter = [CAEmitterLayer layer]; //例子发射位置 snowEmitter.emitterPosition = CGPointMake(120,20); //发射源的尺寸大小 snowEmitter.emitterSi... 阅读全文
posted @ 2015-01-13 10:21 代佳宏 阅读(220) 评论(0) 推荐(0) 编辑
摘要: #import "ViewController.h"@interface ViewController (){ CALayer *_l1;//定义能够全局使用 CALayer *_l2;}@end@implementation ViewController- (void)viewDidLoad { ... 阅读全文
posted @ 2015-01-12 17:19 代佳宏 阅读(197) 评论(0) 推荐(0) 编辑
摘要: - (void)setTitle:(NSString *)title forState:(UIControlState)state;//设置标题- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state;//设置标题颜色... 阅读全文
posted @ 2015-01-08 21:48 代佳宏 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 《 UIControl》1 处理用户事件的控件的基类,如UIButton,UISlider等2 一般不直接实例化,而是使用他的子类3 可以通过跟踪触摸事件来设置和获取控件状态,并且这些方法可以被子类继承//添加一个事件- (void)addTarget:(id)target action:(SEL)... 阅读全文
posted @ 2015-01-08 20:40 代佳宏 阅读(224) 评论(0) 推荐(0) 编辑
摘要: //通过xib文件创建一个视图控制器。并作为窗口的根控制器self.viewController = [[ViewController alloc] initWithNibName:@"ViewController"bundle:nil];//通过代码创建一个视图控制器,self.viewContr... 阅读全文
posted @ 2015-01-08 19:19 代佳宏 阅读(142) 评论(0) 推荐(0) 编辑
摘要: UIImageView的作用是显示图片和多张动态的图片- (id)initWithImage:(UIImage *)image;//初始化图片视图- (id)initWithImage:(UIImage *)image highlightedImage:(UIImage *)highlightedI... 阅读全文
posted @ 2015-01-08 10:24 代佳宏 阅读(145) 评论(0) 推荐(0) 编辑