Gavin.han

致力于移动开发 技术改变生活
随笔 - 133, 文章 - 0, 评论 - 46, 阅读 - 42万

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

随笔分类 -  ios基础知识

摘要:1.UITouchphase属性 返回一个触摸阶段常量,指出触摸开始、继续、结束或被取消。(phase返回的常量:UITouchPhaseBegan/UITouchPhaseMoved/UITouch- PhaseStationary/UITouchedPhaseEnded/UITouchPhaseCancelled)tapCount属性 轻按屏幕的次数。timestamp属性 触摸发生的时间。view属性 触摸始于哪个视图。window 属性 ... 阅读全文

posted @ 2012-12-06 17:58 gavin.han 阅读(531) 评论(0) 推荐(0) 编辑

摘要:以上就是导航栏的效果,导航栏在项目中应用很广泛,需要熟练掌握。 新建项目,选择“Empty Application”,项目命名为:NavigationControllerTest 新建一个UIViewController视图,命名为HomeViewConroller 修改AppDeledate.h和AppDolegate.m源代码 思路: 将home"push到”navigationController中,再将navigationController.View 添加到window中//AppDelegate.m#import<UIKit/UIKit.h>@interfac 阅读全文

posted @ 2012-11-15 22:48 gavin.han 阅读(13430) 评论(2) 推荐(1) 编辑

摘要:使用手势识别六种手势识别(继承于UIGestureRecongnizer基类):UITapGestureRecongnizer--检测view上的单击操作UIPinchGestureRecongnizer--检测view上两个手指的缩放操作UIPanGestureRecongnizer--检测view的拖拽操作UISwipeGestureRecongnizer--检测view的轻划操作UIRotationGestureRecongnizer--检测view的旋转操作UILongPressGestureRecongnizer-检测view上的长按操作UITapGestureRecongnizer 阅读全文

posted @ 2012-11-01 10:36 gavin.han 阅读(2908) 评论(0) 推荐(0) 编辑

摘要:新建Empty Applicaton,添加HomeViewController文件。还是看代码吧,将理论太枯燥,理论在代码中会提到。HomeViewController.h代码:#import <UIKit/UIKit.h>#import <AVFoundation/AVFoundation.h>@interface HomeViewController : UIViewController<AVAudioRecorderDelegate, AVAudioPlayerDelegate>{}@property (nonatomic, retain) AVAud 阅读全文

posted @ 2012-10-30 22:28 gavin.han 阅读(9306) 评论(0) 推荐(1) 编辑

摘要:ios 音频的播放使用到AVFoundation框架。其包含三个主要的类:AVAudioPlayer、AVAudioRecorder和AVAudioSession。它们负责音频的播放、录制和配置,而且都有相对应的delegate协议。支持的格式有:caf/m4a/mp3/aif/wav/au/snd/aac.能够提供基本的播放操作:创建、准备、播放、暂停、跳过和停止,并且支持多个AVAudioPlayer对象的使用。支持音量调节控制、循环播放和左右声道设置等。 AVAudioPlayerDelegate协议有以下重要方法: audioPlayerBeginInterruptio... 阅读全文

posted @ 2012-10-30 20:55 gavin.han 阅读(5258) 评论(1) 推荐(0) 编辑

摘要:一、使用NSTimer实现动画1.新建empty AppLication,添加HomeViewController页面, iphone.png图片2.在HomeViewController.xib中添加Image View,并调整其大小;再添加一个Slider控件3.HomeViewController.h代码:#import <UIKit/UIKit.h>@interface HomeViewController : UIViewController{ CGPoint delta;//坐标变化量 NSTimer *timer; CGSize picSize;//图片大小 }@pr 阅读全文

posted @ 2012-10-29 21:55 gavin.han 阅读(5015) 评论(0) 推荐(1) 编辑

摘要:通过plist文件存取文件在ios文件处理(一)的项目中,修改HomeViewController.m的viewDidLoad方法- (void)viewDidLoad{/* NSString *fileName = [[self documentsPath] stringByAppendingPathComponent:@"content.txt"]; //NSString *fileName = [[self tempPath] stringByAppendingPathComponent:@"content.txt"]; [self writeTo 阅读全文

posted @ 2012-10-28 17:10 gavin.han 阅读(492) 评论(0) 推荐(0) 编辑

摘要:一.在Documents、tmp和Library中存储文件Documents:用于存储应用程序中经常需要读取或写入的常规文件。tmp:用于存储应用程序运行时生成的文件。(随着应用程序的关闭失去了利用价值)Library:一般存放应用程序的配置文件,比如说plist类型的文件。二.读取和写入文件 1.新建Empty Application应用程序,添加HomeViewController文件HomeViewController.h代码:#import <UIKit/UIKit.h>@interface HomeViewController : UIViewController{ }- 阅读全文

posted @ 2012-10-28 16:19 gavin.han 阅读(1477) 评论(2) 推荐(2) 编辑

摘要:通过两种方法来实现:一、通过动态数组NSMutableArray中的数据,来显示数据1.新建Empty Application项目,新建ViewController,HomeViewController,在AppDelegate.m中导入该文件,并在方法- (BOOL)application:didFinishLaunchingWithOptions:中添加以下红色标记的代码- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ . 阅读全文

posted @ 2012-10-28 13:06 gavin.han 阅读(9875) 评论(0) 推荐(2) 编辑

摘要:常用属性:frame,bounds和center重要方法 :addSubview 把一个子控件添加到一个父控件中;Superview 返回子控件的父控件常用函数:- (void)removeFromSuperview; - (void)insertSubview:(UIView *)view atIndex: (NSInteger)index; - (void)exchangeSubviewAtIndex: (NSInteger)index1 withSubviewAtIndex:(NSIn... 阅读全文

posted @ 2012-10-22 11:59 gavin.han 阅读(379) 评论(0) 推荐(0) 编辑

摘要:上面的通过代码实现:NSString *str = @"字符串大小字符串大小字符串大小字符串大小"; UIFont *font = [UIFont fontWithName:@"Arial" size:50.0f]; CGSize size = CGSizeMake(320, 2000); UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero]; [label setNumberOfLines:0]; CGSize labelSize = [str sizeWi... 阅读全文

posted @ 2012-10-22 11:46 gavin.han 阅读(252) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示