06 2012 档案
IOS-翻转效果小插曲:
摘要:使用普通的来CATransition实现转换效果,代码如下:CATransition *animation = [CATransition animation];[animation setDuration:0.3];[animation setType: kCATransitionMoveIn]; //kCATransitionFade,kCATransitionPush,kCATransitionReveal[animation setSubtype: kCATransitionFromTop]; //kCATransitionFromRight,kCATransitionFromLeft 阅读全文
posted @ 2012-06-29 17:51 tx天翔 阅读(461) 评论(0) 推荐(0)
IOS-自定义navigationBar,设置背景方法:
摘要:自定义的navigationBar,设置背景方法:IOS 5.0以前的设备添加:@implementation UINavigationBar (CustomImage) - (void)drawRect:(CGRect)rect { UIImage *image = [UIImage imageNamed: @"add_nav_bg_ipad.png"]; [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; }@endIOS 5.0 以后的设备再添加:在vi 阅读全文
posted @ 2012-06-29 16:59 tx天翔 阅读(2543) 评论(0) 推荐(0)
IOS-UITableView设置背景图片,方式与众不同。
摘要:UITableView设置背景图片:即设置tableView的backgroundViewUIView *view = [[UIView alloc] init]; view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"view_bg_ipad.png"]]; self.tableView.backgroundView = view; 阅读全文
posted @ 2012-06-29 16:53 tx天翔 阅读(5349) 评论(0) 推荐(0)
IOS-图标知识详情(转载自http://luoyl.info/blog/2012/03/iphone-ipad-icons/)
摘要:iPhone和iPad的图标图标是IOS程序包所必需的组成部分。如果你没有提供程序所需的各种尺寸的图标,程序上传发布时可能会无法通过验证。IOS程序为兼顾不同的应用场景,定义了多个不同规格的图标,并以不同的命名区分:IOS图标尺寸一览iPhone专用程序:图标名称大小圆角用途必需Icon.png57 X 5710px用于程序商店和在iPhone/iPod Touch中显示必需Icon@2x.png114 X 11420pxIcon.png的高清模式Icon-Small.png29 X 2920px用于设置和Spotlight搜索Icon-Small@2x.png58 X 588pxIcon-S 阅读全文
posted @ 2012-06-28 11:38 tx天翔 阅读(544) 评论(0) 推荐(0)
IOS-Create UIActionSheet 'otherButtons' by passing in array
摘要:例子如下:NSMutableArray*buttonTitles =[NSMutableArray array];if(condition1){ [buttonTitles addObject:@"Do action 1"];}if(condition2){ [buttonTitles addObject:@"Do action 2"];}if(condition3){ [buttonTitles addObject:@"Do action 3"];}if(condition4){ [buttonTitles addObject:@& 阅读全文
posted @ 2012-06-28 09:37 tx天翔 阅读(241) 评论(0) 推荐(0)
IOS-NSNotification的简单使用流程:
摘要:NSNotification的简单使用流程(例子)如下:1、在viewDidLoad添加:- (void)viewDidLoad{//添加如下 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showAlertView:) name:@"showAlertView" object:nil];}2、.m文件中添加:(例子如下)- (void)showAlert:(NSString *)msg{ UIAlertView *alert = [[UIAlertView alloc] 阅读全文
posted @ 2012-06-26 10:41 tx天翔 阅读(3000) 评论(0) 推荐(0)
IOS-selector注意事项:@selector(showAlertView:)
摘要:1、@selector(showAlertView:)——带冒号的,表示带参数。其行为对应如下形式:-(void)showAlertView:(id)sender{}2、@selector(showAlertView)——没有冒号,表示无参数。其行为对应如下形式:-(void)showAlertView{} 阅读全文
posted @ 2012-06-26 10:31 tx天翔 阅读(241) 评论(0) 推荐(0)
IOS-注意:windows上加view,view下移20
摘要:AppDelegate * appDelegate = [[UIApplication sharedApplication] delegate];AppRaterView * raterView = [[AppRaterView alloc] initWithNibName:@"AppRaterView" bundle:nil]; CGRect f = CGRectOffset(raterView.view.frame, 0.0, 20.0); raterView.view.frame = f; [appDelegate.window addSubview:raterVie 阅读全文
posted @ 2012-06-20 17:43 tx天翔 阅读(252) 评论(0) 推荐(0)
IOS-MFMailComposeViewController自定义NavBar
摘要:1、NavBar背景图片及barbuttonItem的颜色设置: picker.navigationBar.tintColor = [UIColor colorWithRed:209.0/255 green:183.0/255 blue:126.0/255 alpha:1.0]; if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 5.0) { [picker.navigationBar setBackgroundImage:[UIImage imageNamed:@"nav_bg.png"] fo 阅读全文
posted @ 2012-06-20 11:07 tx天翔 阅读(1460) 评论(0) 推荐(0)
IOS-OpenURL
摘要:直接使用本地浏览器打开url:[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunesconnect.apple.com"]]; 阅读全文
posted @ 2012-06-19 16:34 tx天翔 阅读(279) 评论(0) 推荐(0)
IOS-判断camera是否可用,ActionSheet中button数量动态更改
摘要:示例如下:UIActionSheet *playerIconSheet = [[UIActionSheet alloc] initWithTitle:@"" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:nil, nil]; if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera])//判断camera 阅读全文
posted @ 2012-06-19 11:24 tx天翔 阅读(685) 评论(0) 推荐(0)
IOS-获取Model(设备型号)、Version(设备版本号)、app(程序版本号)等
摘要:NSLog(@"uniqueIdentifier: %@", [[UIDevice currentDevice] uniqueIdentifier]); NSLog(@"name: %@", [[UIDevice currentDevice] name]); NSLog(@"systemName: %@", [[UIDevice currentDevice] systemName]); NSLog(@"systemVersion: %@", [[UIDevice currentDevice] systemVersi 阅读全文
posted @ 2012-06-18 16:02 tx天翔 阅读(8363) 评论(0) 推荐(1)
IOS-animated使用注意
摘要:在做动画效果时,使用的渐进效果好。但是,在做修改参数时,需要是即时的修改,因此,就不要使用animated的动画效果了。例子如下:[self.pickerView.playerPicker setContentOffset:CGPointMake(elf.pickerView.playerPicker.contentOffset.x + 52, self.pickerView.playerPicker.contentOffset.y) animated:NO];//animated:YES 时,self.pickerView.playerPicker.contentOffset.x 不是即时修 阅读全文
posted @ 2012-06-12 11:14 tx天翔 阅读(2101) 评论(0) 推荐(0)
IOS-应用图标去玻璃质感效果
摘要:1、选中项目中的.plist文件。2、右侧列表中,有两处修改: @1、Icon files(IOS 5)->Primary Icon ->Icon already includes gloss effect ->选为YES; @2、Icon already includes gloss effect... 阅读全文
posted @ 2012-06-12 09:32 tx天翔 阅读(261) 评论(0) 推荐(0)
IOS-使用AVAudioPlayer播放音乐文件
摘要:AVAudioPlayer 提供了大量的特性,包括暂停播放,调整音量,监控音频的峰值和均值等等。AVAudioPlayer *player;NSString *path;// 设置音乐文件路径path = [[NSBundle mainBundle] pathForResource:@"sound-file" ofType:@"mp3"];// 判断是否可以访问这个文件if ([[NSFileManager defaultManager] fileExistsAtPath:path]) { // 设置 player player = [[AVAudioP 阅读全文
posted @ 2012-06-11 15:45 tx天翔 阅读(3709) 评论(0) 推荐(0)
IOS-NSDate输出string方式小记
摘要:1、 NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateStyle:NSDateFormatterMediumStyle]; [formatter setTimeStyle:NSDateFormatterMediumStyle]; NSLog(@"%@", [formatter stringForObjectValue:run.date]); 阅读全文
posted @ 2012-06-11 09:22 tx天翔 阅读(880) 评论(0) 推荐(0)
IOS-翻转时,使用2个view的交换(需注意)
摘要:- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration { if (interfaceOrientation == UIInterfaceOrientationPortrait) { self.view = self.portrait; self.view.transform = CGAffineTransformIdentity; self.view.transform = CGAff... 阅读全文
posted @ 2012-06-09 10:19 tx天翔 阅读(1467) 评论(0) 推荐(0)
IOS-获取senderTitle
摘要:NSString *title = [sender titleForState:UIControlStateNormal]; 阅读全文
posted @ 2012-06-09 08:53 tx天翔 阅读(147) 评论(0) 推荐(0)
IOS-创建带Navigation的根控制器
摘要:UINavigationController *rootVC = [[[UINavigationController alloc] initWithRootViewController:[[rootViewController alloc] init]]autorelease]; self.window.rootViewController = rootVC; 阅读全文
posted @ 2012-06-08 16:19 tx天翔 阅读(267) 评论(0) 推荐(0)
Mac 数字键盘中数字键(0-9)不能用,解决方法:
摘要:在“系统偏好设置——Personal——Universal Access——Mouse——Mouse key” OFF 掉。就OK了! 阅读全文
posted @ 2012-06-08 09:08 tx天翔 阅读(2333) 评论(0) 推荐(0)
Mac OS X 键盘快捷键
摘要:要使用键盘快捷键或组合键,您可以同时按修饰键和字符键。例如,同时按下 Command 键(标有 符号的按键)和“c”键会将当前选中的任何内容(文本、图形等等)拷贝至夹纸板。这也称作 Command-C 组合键(或键盘快捷键)。许多组合键中都包含修饰键。修饰键将改变 Mac OS X 对其他按键或鼠标点按动作的解释方式。修饰键包括 Command、Control、Option、Shift、Caps Lock 和 fn 键(如果您的键盘有 fn 键)。以下是出现在 Mac OS X 菜单中的修饰键符号:(Command 键) - 在某些 Apple 键盘上,此键也可能带有 Apple 标志()(. 阅读全文
posted @ 2012-06-08 09:03 tx天翔 阅读(977) 评论(0) 推荐(0)
IOS-erica的书code-URL
摘要:https://github.com/ericaiOS-5-Cookbookiphone-3.0-cookbook- 阅读全文
posted @ 2012-06-07 11:21 tx天翔 阅读(154) 评论(0) 推荐(0)
IOS-synthesize和dynamic的异同
摘要:一、SDK中描述是在声明property的时候,有2个选择1:通过@synthesize 指令告诉编译器在编译期间产生getter/setter方法。2:通过@dynamic指令,自己实现方法。有些存取是在运行时动态创建的,如在CoreData的NSManagedObject类使用的某些。如果你想这些情况下,声明和使用属性,但要避免缺少方法在编译时的警告,你可以使用@dynamic动态指令,而不是@synthesize合成指令。例如@interface Demo : NSManagedObject {}@property (retain) NSString* test;@end]@implem 阅读全文
posted @ 2012-06-06 18:08 tx天翔 阅读(4860) 评论(0) 推荐(0)
IOS-转场动画Quartz Core的Core Animation函数包
摘要:创建转场你所要创建的转场是CATransition对象,这种对象属于Quartz Core的Core Animation函数包。一个动画中包含了多种属性,比如计时函数、动画类型以及持续时长等。要创建一个动画,需要调用这个类的animation方法。如下例所示:#import<QuartzCore/CAAnimation.h>CATransition*myTransition=[CATransitionanimation];计时函数计时函数决定了动画在从头到尾执行时的流畅程度。同一个动画可以用不同的速度来执行。例如,页面翻转动画可以开始的时候比较慢,然后在动画快结束时加速,也可以反过 阅读全文
posted @ 2012-06-05 18:00 tx天翔 阅读(1445) 评论(0) 推荐(0)
IOS-SegmentedControl(添加到Nav上)的简单使用方法
摘要:/*初始化导航按钮*/ {credits=[[[UIBarButtonItemalloc] initWithTitle:@"Credits" style:UIBarButtonItemStylePlain target:appDelegate action:@selector(credits)] autorelease]; self.navigationItem.rightBarButtonItem=credits; segmentedControl=[[UISegmentedControlalloc]initWithItems:nil]; segmentedControl 阅读全文
posted @ 2012-06-05 17:56 tx天翔 阅读(2059) 评论(0) 推荐(0)
IOS-导航风格:BarButton创建
摘要:一个导航风格(风格属性)栏可以容纳很多种不同类型的对象。你刚刚学过了如何将一个分段控件作为标题试图加入到导航栏中,来向用户呈现一组子类别。 另一个用于导航栏的流行UI组件是UIToolbar对象。工具栏可以容纳一组自定义的按钮,其中可以包括标准系统按钮,例如书签和搜索等按钮。许多预置 的iPhone应用程序,例如Safari和Mail,都使用工具栏来对导航栏的功能进行扩展。在显示工具栏之前,你必须首先创建打算在工具栏上显示的按钮。你需要用Cocoa的NSMutableArray方法,将每个按钮都添加到一个数组中:NSMutableArray*buttons=[[NSMutableArrayal 阅读全文
posted @ 2012-06-05 17:45 tx天翔 阅读(6930) 评论(0) 推荐(1)
IOS-添加分段控件SegmentControl
摘要:添加分段控件控件是一种小型的、自包含的UI组件,可以用在各种UI Kit类中。它们可以被附着在许多不同类型的对象之上,让开发者可以在窗口中添加额外的功能。有一个控件在苹果公司预装的应用程序的导航栏中经常见到,这就是分段控件。你会注意到,在许多预置的应用程序中,苹果公司加入一些按钮以便对显示的信息做进一步分类。例如,iTunes WiFi Store应用程序的导航栏上就显示着"最新发行"、"热门金曲"、"风格流派"等按钮。这些按钮进一步划分了用户的乐曲选择方式。分段控件就适用于这种 情况:存在大量相似数据,最好用两到三个按钮对数据进行分 阅读全文
posted @ 2012-06-05 17:29 tx天翔 阅读(31809) 评论(1) 推荐(2)
[教程]iOS 4 开发的好东西 (资料)url
摘要:http://bbs.weiphone.com/read-htm-tid-2323882.html 阅读全文
posted @ 2012-06-05 16:55 tx天翔 阅读(292) 评论(0) 推荐(1)
IOS-textField或textView赋予内容string
摘要:赋予内容视图中的文字可以通过一个名为text的属性来设置。这个属性接受一个NSString作为参数。下面给出了一种设置静态文本的简单方法:textView.text=@"Hello,world!";你也可以用NSString类中的多种字符串创建方法,来定制创建字符串对象:intnBottles=100; NSString*myFormattedString=[[NSStringalloc] initWithFormat:@"%dbottlesofbeeronthewall",nBottles ]; textView.text=myFormattedStr 阅读全文
posted @ 2012-06-05 16:14 tx天翔 阅读(6320) 评论(0) 推荐(0)
IOS-文字色彩UIColor
摘要:文字色彩可以用一个UIColor对象来定义文字的色彩。UIColor这个类提供了许多不同的方法,可以很轻松地调出任何颜色。你可以用静态方法来创建 颜色,这样它们会在停止使用后被释放。可以用灰度值、色相或者RGB复合值等多种形式来创建颜色。要创建一个简单的RGB色彩,可以指定一组4个浮点值, 分别对应红、绿、蓝和alpha值(透明度),取值均在0.0~1.0之间。这些值表示了0%(0.0)~100%(1.0)的范围:UIColor*myWhiteTransparentColor=[UIColorcolorWithWhite:1.0alpha:0.50]; UIColor*myColorHue=[ 阅读全文
posted @ 2012-06-05 16:04 tx天翔 阅读(16162) 评论(0) 推荐(0)
IOS-datePicker的简单使用
摘要:datePicker的简单使用方法:(注意连线)- (IBAction)buttonpressed:(id)sender { NSDate *selected = [datePicker date]; NSTimeZone *timeZone3 = [NSTimeZone timeZoneForSecondsFromGMT:3600*8]; NSDateFormatter *formatter3 = [[NSDateFormatter alloc] init]; [formatter3 setTimeZone:timeZone3]; [formatter3 setDateFormat:@&qu 阅读全文
posted @ 2012-06-05 14:28 tx天翔 阅读(3470) 评论(0) 推荐(0)
IOS-创建Button简单实例
摘要:CGRect frame; MyButton *btn = [[MyButton buttonWithType:UIButtonTypeCustom] retain]; btn.index = i; btn.value = [NSString stringWithFormat:@"name%d",i]; NSString *named = [array objectAtIndex:i]; NSURL *url2 = [NSURL URLWithString:named]; UIImage *img = [UIImage imageWithData:[NSData dataW 阅读全文
posted @ 2012-06-05 12:26 tx天翔 阅读(2130) 评论(0) 推荐(0)
IOS-ActionSheet、AlertView、Slider、Switch的简单使用
摘要:ActionSheet、AlertView、Slider、Switch的简单使用方法如下:- (IBAction)buttonPressed:(id)sender { UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Are you sure" delegate:self cancelButtonTitle:@"No way" destructiveButtonTitle:@"Yes,I'm sure!" otherButtonTitles: 阅读全文
posted @ 2012-06-05 11:42 tx天翔 阅读(978) 评论(0) 推荐(0)
IOS-翻转注意
摘要:翻转时,要计算好。如下是6个button的翻转中 frame 的改变- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{ if (toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {/ 阅读全文
posted @ 2012-06-05 11:07 tx天翔 阅读(486) 评论(0) 推荐(0)
IOS-关闭(退)键盘事件
摘要:方法:1、手势(触背景)关闭键盘-(void)tapBackground //在ViewDidLoad中调用{ UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@sel... 阅读全文
posted @ 2012-06-05 10:58 tx天翔 阅读(9126) 评论(2) 推荐(1)
IOS-导航栏风格
摘要:导航控制器可以用几种不同的风格来显示自身。默认风格就是标准的灰色外观。目前支持三种不同的风格。风 格描 述UIBarStyleDefault默认风格;灰色背景,白色文字UIBarStyleBlack纯黑色背景,白色文字UIBarStyleBlackOpaque纯黑色背景,白色文字 UIBarStyleBlackTranslucent透明黑色背景,白色文字风格是通过barStyle属性来设置的。这个属性属于导航控制器,而不是视图控制器,因此在各个视图之间来回切换时,此属性可以保持一致:self.navigationController.navigationBar.barStyle= UIBarS 阅读全文
posted @ 2012-06-05 10:21 tx天翔 阅读(6734) 评论(0) 推荐(0)
IOS-按钮风格style(plain、bordered、done)辨析
摘要:style定义按钮的风格。可用的风格有:UIBarButtonItemStylePlain 默认按钮风格;按下时会闪动UIBarButtonItemStyleBordered 与UIBarButtonItemStylePlain相同,但显示的按钮有边框UIBarButtonItemStyleDone 显示一个蓝色按钮,提醒用户编辑完毕时应该点触(tap)该按钮。 阅读全文
posted @ 2012-06-05 09:47 tx天翔 阅读(3978) 评论(0) 推荐(0)