08 2013 档案
UIWebView
摘要:#import @interface ViewController : UIViewController@property (nonatomic, strong) UIWebView *webView;@end#import "ViewController.h"@interfaceViewController ()@end@implementation ViewController/* UIWebViewDelegate 协议的optional方法*/- (void)webViewDidStartLoad:(UIWebView *)webView{ [[UIApplicat 阅读全文
posted @ 2013-08-30 17:32 (@_@)~ 阅读(263) 评论(0) 推荐(0)
UIScrollView
摘要:对于Scroll views一个最基础的问题就是content size。Scroll view将严格按照这个size来展示其内容。展示一个size大于screen的图片:头文件:#import @interface ViewController : UIViewController@property (strong,nonatomic) UIImageView *imageView;@property (nonatomic,strong) UIScrollView *myScrollView;@end实现#import "ViewController.h"@interfa 阅读全文
posted @ 2013-08-27 12:45 (@_@)~ 阅读(287) 评论(0) 推荐(0)
UIButton
摘要:头文件#import @interface ViewController : UIViewController@property (nonatomic,strong) UIButton *myButton;@end实现#import "ViewController.h"@interfaceViewController ()@end@implementation ViewController- (void) buttonIsPressed: (UIButton *) paramSender { NSLog(@"Button is pressed.");}- 阅读全文
posted @ 2013-08-25 19:24 (@_@)~ 阅读(223) 评论(0) 推荐(0)
Accepting User Text Input with UITextField
摘要:textField在Interfa Builder中不能改变高度,但是在代码中可以,无论怎么改变其高度,行数始终是1头文件#import @interface ViewController : UIViewController //为了监听用户触发的事件,例如开始输入,完成输入等,text Field要有自己的代理,这个代理遵守协议@property (nonatomic,strong) UITextField *textField;@property (nonatomic,strong) UILabel *labelCounter;@end实现#import "ViewContr. 阅读全文
posted @ 2013-08-25 17:04 (@_@)~ 阅读(320) 评论(0) 推荐(0)
Displaying Static Text with UILabel
摘要:头文件:#import @interface ViewController : UIViewController@property (nonatomic,strong) UILabel *myLabel;@end实现:#import "ViewController.h"@interfaceViewController ()@end@implementation ViewController- (void)viewDidLoad{ [superviewDidLoad]; CGRect lableFrame = CGRectMake(0.0f,0.0f,100.0f,500.0 阅读全文
posted @ 2013-08-23 19:34 (@_@)~ 阅读(140) 评论(0) 推荐(0)
Save Data
摘要:1.简单的data:string、numbers/boobleans,dates,arrays.可以保存在合适的lists(.plist)中。2. 储存应用程序的设置或者一些偏好:最好不要存储,如果一定要,苹果有setting rules叫setting bundle3.SQLite 数据库,可以在里面储存一些表格。4 Core Data5 iCloud Storage6.储存在哪:ios有一个文件系统(不是经常用),应用程序有一个文件夹:tmp and library folder(路径不明显而且不是自己决定的); 阅读全文
posted @ 2013-08-23 15:44 (@_@)~ 阅读(527) 评论(0) 推荐(0)
Storyboards
摘要:seguescene------->scene1.push: 转换在nav controller下才有作用(选中第一个view--Editor--Embed in(把……嵌入)--Nav Controller)2. 需要为每一个scene创建一个类,我们向这个scene中拖拽的是哪种controller那么这个对应的类就继承哪种controller。将这些类加入到对应的controller中(修改Custom Class 下的Class,使其是这个scene对应的那个类名。)3. 在每一个.h文件中引入本身要转向的那个.h文件4.新方法:-(void)prepareForSegue,用来 阅读全文
posted @ 2013-08-23 15:38 (@_@)~ 阅读(145) 评论(0) 推荐(0)
xcode template
摘要:1. 工程项目模板类型的更改 Xcode4时代 Xcode4+新模板Navigation-based Application ------->Master-Detail Application=> iphoneSplite View-based Application ------->Master-Detail Application => ipadOpenGL ES Application --------------->OpenGL GameTab Bar Application --------------->Tabbed ApplicationUti 阅读全文
posted @ 2013-08-23 15:37 (@_@)~ 阅读(346) 评论(0) 推荐(0)
应用程序的lifeCycle
摘要:main--UIApplicationmain--UIApplication--app delegate--监听启动应用程序等动作自动调用一些方法如加载UIWindow(透明的)--view controller(.h .m and .xib)等,再AppDelegate中有详细描述。相应的ViewController也会调用一些方法如viewDidLoad. 阅读全文
posted @ 2013-08-23 15:33 (@_@)~ 阅读(184) 评论(0) 推荐(0)
ios 三种方法 使KeyBoard消失
摘要:1. [myTextField resignFirstResponder];2. 按空白处消失:拖入一个Butto,使其布满整个view,设置起为Send to Back (editor--Arrange--Send to Back),改变Type为custom使其颜色为原来view的背景颜色。最后将其与code链接IBAction{[myTextField resignFirstResponder];}3.使用KeyBoard上的Return键使其消失:设置textField的Outlets中delegate链接到File's owner.(因为textfield object可以使 阅读全文
posted @ 2013-08-23 15:30 (@_@)~ 阅读(292) 评论(0) 推荐(0)
xcode 调试
摘要:崩溃:有两种最基本的crash类型常发生:SIGABRT(也叫EXC_CRASH)和EXC_BAD_ACCESS(也可能会是SIGBUS或者SIGSEGV)。就crash而言,SIGABRT是一个比较好解决的,因为他是一个可掌控的crash。App会在一个目的地终止,因为系统意识到app做了一些他不能支持的事情。EXC_BAD_ACCESS是一个比较难处理的crash了,当一个app进入一种毁坏的状态,通常是由于内存管理问题而引起的时,就会出现出现这样的crash。[UINavigationController setList:]: unrecognized selector sent to 阅读全文
posted @ 2013-08-23 15:28 (@_@)~ 阅读(313) 评论(0) 推荐(0)
内存管理 ios
摘要:用alloc,new,copy和mutableCopy创建的对象必须自己释放,其他对象都可以当成是引用计数为1且位于自动回收池中。1. NSString *second= [[NSString alloc] init]; //second的引用计数为1 [someStringArray addObject: second]; //2 。被插入数组中,数组回自动持有加入其中对象。//需要一次release2. NSString *sixth= [NSString stringWithString:@"Toughie"]; //1 NSArray *anotherArray = 阅读全文
posted @ 2013-08-23 15:26 (@_@)~ 阅读(120) 评论(0) 推荐(0)
objective-c中的消息使用有名称的参数
摘要:一个方法声明:-(NSInteger) pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:返回类型 方法名称 第一个参数类型 本地参数名称 第二个参数公开名称(NSInteger) component第二个参数类型 第二个参数的本地名称将上面的消息发送给接收者:[pickerDelegate pickerView:somePicker numberOfRowsInComponent:component]; 接收者 消息名称 值 第二个参数名称 第二个参数值在objective-c中可以为参数... 阅读全文
posted @ 2013-08-23 15:21 (@_@)~ 阅读(182) 评论(0) 推荐(0)
Presenting Sharing Options with UIActivityViewController
摘要:需要实例化UIActivityViewController这个类,通过initWithActivityItems:applicationActivities: 方法:initWithActivityItems:要分享的东西,可以是NSString, UIImage, 自己定义的符合UIActivityItemSource 协议的类的实例。applicationActivities:代表这项分享的动作你自动的应用可以支持将用户输入的文字发送到UIActivityViewController类的实例化头文件#import @interface ViewController : UIViewCont 阅读全文
posted @ 2013-08-23 15:13 (@_@)~ 阅读(284) 评论(0) 推荐(0)
UISegmentedControl
摘要:@implementation ViewController//call this method when user select a different one- (void) segmentChanged: (UISegmentedControl *) paramSender { if ([paramSender isEqual:self.mySegmentedControl]) { NSInteger selectedSegmentIndex = [paramSender selectedSegmentIndex]; NSString *selectedSegmentTe... 阅读全文
posted @ 2013-08-20 12:16 (@_@)~ 阅读(226) 评论(0) 推荐(0)
UISlider
摘要:@implementation ViewController- (UIImage *) minimumTrackImage{ // thumb左侧样式 UIImage *result = [UIImage imageNamed:@"MinimumTrack"]; UIEdgeInsets edgeInsets; edgeInsets.left = 4.0f; edgeInsets.top = 0.0f; edgeInsets.right = 0.0f; edgeInsets.bottom = 0.0f; result = [result resizableIm... 阅读全文
posted @ 2013-08-18 18:56 (@_@)~ 阅读(227) 评论(0) 推荐(0)