- 浏览: 326686 次
- 性别:
- 来自: 深圳
文章分类
最新评论
-
ljl961890233bear:
...
利用MySQL Cluster 7.0 + LVS 搭建高可用环境 -
wang1352083:
$m->listDBs(); 返回的是一个有dbnam ...
MongoDB PHP API 及用法 -
走忽闪953:
...
putty PasswordAuthentication -
jxhgzs001:
很好 很强大,不顶你一下 觉得过意不去啊
cocos2d 的一些实用代码 -
lingtianlan:
我实际测试的结果却和你不一样,调用顺序是awakeFromNi ...
[转]loadView/viewDidLoad/initWithNibName/awakeFromNib/initWithCoder的用法
- (NSString *)URLEncodedString:(NSString *)string{
NSString *result = (NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
(CFStringRef)string,NULL,CFSTR("!*'();:@&=+$,/?%#[]"),kCFStringEncodingUTF8);
[result autorelease];
return result;
}
//生成nonce
- (NSString *)generateNonce{
CFUUIDRef theUUID = CFUUIDCreate(NULL);
CFStringRef string = CFUUIDCreateString(NULL, theUUID);
NSMakeCollectable(theUUID);
return [(NSString *)string stringByReplacingOccurrencesOfString:@"-" withString:@""];
//return (NSString *)string;
}
//生成Timestamp
- (NSString *)generateTimestamp{
return [[NSString stringWithFormat:@"%d", time(NULL)] retain];
}
iPhone键盘改变颜色
只有这2种数字键盘才有效果:UIKeyboardTypeNumberPad,UIKeyboardTypePhonePad
keyboardAppearance = UIKeyboardAppearanceAlert
代码如下:
1. NSArray *ws = [[UIApplication sharedApplication] windows];
2. for(UIView *w in ws){
3. NSArray *vs = [w subviews];
4. for(UIView *v in vs){
5. if([[NSString stringWithUTF8String:object_getClassName(v)] isEqualToString:@"UIKeyboard"]){
6. v.backgroundColor = [UIColor redColor];
7. }
8. }
9. }
从一个界面push到下一界面左上角返回按钮文字设置
在父viewController中如下设置:
UIBarButtonItem *backbutton = [[UIBarButtonItem alloc]init];
backbutton.title = @"返回列表";
self.navigationItem.backBarButtonItem = backbutton;
[backbutton release];
navigationbar的back键触发其他事件
UIButton *back =[[UIButton alloc] initWithFrame:CGRectMake(200, 25, 63, 30)];
[back addTarget:self action:@selector(reloadRowData:) forControlEvents:UIControlEventTouchUpInside];
[back setImage:[UIImage imageNamed:@"返回按钮.png"] forState:UIControlStateNormal];
UIBarButtonItem *backButtonItem = [[UIBarButtonItem alloc] initWithCustomView:back];
self.navigationItem.leftBarButtonItem = loginButtonItem
[back release];
[backButtonItem release];
防止屏幕暗掉锁屏
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
将图片从左到右翻页效果显示
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 0, 470)];
[imageView setImage:[UIImage imageNamed:@"Bg.jpg"]];
self.myImageView =imageView;
[self.view addSubview:imageView];
[imageView release];
CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:nil context:context];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.5];
[myImageView setFrame:CGRectMake(0, 0, 310, 470)];
[UIView commitAnimations];
让覆盖在下面层的视图接受触摸事件
searchImage.exclusiveTouch = YES;//第一层
searchImage.userInteractionEnabled = NO;
myMapView.exclusiveTouch = NO;//第二层
myMapView.userInteractionEnabled = YES;
View的缩放
NSValue *touchPointValue = [[NSValue valueWithCGPoint:CGPointMake(100,100)] retain];
[UIView beginAnimations:nil context:touchPointValue];
transform = CGAffineTransformMakeScale(0.1,0.21);
firstPieceView.transform = transform;
[UIView commitAnimations];
代码循环添加按钮,其他空间也可以用类似方法添加
- (void)viewDidLoad {
[super viewDidLoad];
for(int i = 0; i < 5; i++){
CGRect frame;
Btn[i] = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
[Btn[i] setImage:[UIImage imageNamed:@"Button.png"] forState:UIControlStateNormal];//设置按钮图片
frame.size.width = 55;//设置按钮坐标及大小
frame.size.height = 84;
frame.origin.x = (i%5)*57+5;
frame.origin.y = 10;
[Btn[i] setFrame:frame];
[Btn[i] setBackgroundColor:[UIColor clearColor]];
[Btn[i] addTarget:self action:@selector(btnPressed:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:Btn[i]];
[Btn[i] release];
}
}
//响应按钮事件
-(void)btnPressed:(id)sender{
for(int i = 0; i < 5;i++){
if([sender isEqual:Btn[i]]){
NSLog(@"Btn[%d]:",i);
}
}
}
去除nsstring中的空格,table 以及newline,nextline
NSCharacterSet *whitespace = [NSCharacterSet whitespaceAndNewlineCharacterSet];
NSString *username = [mUsernameField stringValue];
username = [username stringByTrimmingCharactersInSet:whitespace];
UIImagePickerController
用UIImagePickerController选择、显示图片或视频,主要注意UIImagePickerController几个属性的设置
一:UI 显示样式,显示的格式确定
1:sourceType
@property(nonatomic) UIImagePickerControllerSourceType sourceType
enum {
UIImagePickerControllerSourceTypePhotoLibrary,
UIImagePickerControllerSourceTypeCamera,
UIImagePickerControllerSourceTypeSavedPhotosAlbum
};
typedef NSUInteger UIImagePickerControllerSourceType;
sourceType用来确定用户界面显示的样式:
共三种格式(模拟器上的效果图)
UIImagePickerControllerSourceTypePhotoLibrary,
UIImagePickerControllerSourceTypeCamera,
UIImagePickerControllerSourceTypeSavedPhotosAlbum
为了区分是否支持视频格式,一般要用到下面这个函数,以便确定mediaTypes。
+ (BOOL)isSourceTypeAvailable:(UIImagePickerControllerSourceType)sourceType
2: mediaTypes
@property(nonatomic,copy) NSArray *mediaTypes
mediaTypes用来确定再picker里显示那些类型的多媒体文件,图片?视频?
+ (NSArray *)availableMediaTypesForSourceType:(UIImagePickerControllerSourceType)sourceType
二:选取动作处理
UIImagePickerControllerDelegate
通过代理来完成用户在选中图片,或者choose视频时的处理方式:
共有三个可选的代理方法
– imagePickerController:didFinishPickingMediaWithInfo:
– imagePickerControllerDidCancel:
– imagePickerController:didFinishPickingImage:editingInfo: Deprecated in iPhone OS 3.0
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
info中包括选取的照片,视频的主要信息
NSString *const UIImagePickerControllerMediaType; 选取的类型 public.image public.movie
NSString *const UIImagePickerControllerOriginalImage; 修改前的UIImage object.
NSString *const UIImagePickerControllerEditedImage; 修改后的UIImage object.
NSString *const UIImagePickerControllerCropRect; 原始图片的尺寸NSValue object containing a CGRect data type
NSString *const UIImagePickerControllerMediaURL; 视频在文件系统中 的 NSURL地址
保存视频主要时通过获取其NSURL 然后转换成NSData
实例代码如下:
- (void) pickImage: (id) sender
{
UIImagePickerController *ipc = [[UIImagePickerController alloc] init];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]){
ipc.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
ipc.mediaTypes =[UIImagePickerController availableMediaTypesForSourceType:ipc.sourceType];
}
ipc.delegate = self;
ipc.allowsImageEditing = NO;
[self presentModalViewController:ipc animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
if ([mediaType isEqualToString:@"public.image"]){
// UIImage *selectedImage = [info objectForKey:UIImagePickerControllerOriginalImage];
UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
NSLog(@"found an image");
[UIImageJPEGRepresentation(image, 1.0f) writeToFile:[self findUniqueSavePath] atomically:YES];
SETIMAGE(image);
CFShow([[NSFileManager defaultManager] directoryContentsAtPath:[NSHomeDirectory() stringByAppendingString:@"/Documents"]]);
}
else if ([mediaType isEqualToString:@"public.movie"]){
NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL];
NSLog(@"found a video");
NSData *webData = [NSData dataWithContentsOfURL:videoURL];
//NSData *video = [[NSString alloc] initWithContentsOfURL:videoURL];
[webData writeToFile:[self findUniqueMoviePath] atomically:YES];
CFShow([[NSFileManager defaultManager] directoryContentsAtPath:[NSHomeDirectory() stringByAppendingString:@"/Documents"]]);
// NSLog(videoURL);
}
[picker dismissModalViewControllerAnimated:YES];
}
UITextInputTraits属性
autocapitalizationType 设置键盘自动大小写的属性 UITextAutocapitalizationTypeNone
autocorrectionType property 设置是否有自动修改提示 UITextAutocorrectionTypeNo
enablesReturnKeyAutomatically Boolean值-设置在用户没有输入是returnKey禁用,默认值NO
keyboardAppearance 设置键盘显示方式 除了默认模式 还有一个UIKeyboardAppearanceAlert模式
keyboardType 设置键盘类型 UIKeyboardTypePhonePad 等
returnKeyType 设置renturnKey按键上的提示文字 UIReturnKeyGo UIReturnKeyNext
secureTextEntry BOOL值 -- 设置是否是密码保护模式输入
如下:
设置登录用的 输入框 UITextField
用户名输入框:
m_TF_username = [[UITextField alloc] initWithFrame:my_frame];
m_TF_username.borderStyle = UITextBorderStyleNone;
m_TF_username.clearButtonMode = UITextFieldViewModeWhileEditing;
m_TF_username.delegate = self;
m_TF_username.returnKeyType = UIReturnKeyNext;
m_TF_username.autocapitalizationType = UITextAutocapitalizationTypeNone;
[m_TF_username becomeFirstResponder];
密码输入框:
m_TF_password = [[UITextField alloc] initWithFrame:my_frame];
m_TF_password.borderStyle = UITextBorderStyleNone;
m_TF_password.clearButtonMode = UITextFieldViewModeWhileEditing;
m_TF_password.delegate = self;
m_TF_password.returnKeyType = UIReturnKeyGo;
m_TF_password.secureTextEntry =YES;
键盘透明
textField.keyboardAppearance = UIKeyboardAppearanceAlert;
状态栏的网络活动风火轮是否旋转
[UIApplication sharedApplication].networkActivityIndicatorVisible,默认值是NO。
截取屏幕图片
//创建一个基于位图的图形上下文并指定大小为CGSizeMake(200,400)
UIGraphicsBeginImageContext(CGSizeMake(200,400));
//renderInContext 呈现接受者及其子范围到指定的上下文
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
//返回一个基于当前图形上下文的图片
UIImage *aImage = UIGraphicsGetImageFromCurrentImageContext();
//移除栈顶的基于当前位图的图形上下文
UIGraphicsEndImageContext();
//以png格式返回指定图片的数据
imageData = UIImagePNGRepresentation(aImage);
更改cell选中的背景
UIView *myview = [[UIView alloc] init];
myview.frame = CGRectMake(0, 0, 320, 47);
myview.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"0006.png"]];
cell.selectedBackgroundView = myview;
在数字键盘上添加button:
//定义一个消息中心
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; //addObserver:注册一个观察员 name:消息名称
- (void)keyboardWillShow:(NSNotification *)note {
// create custom button
UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
doneButton.frame = CGRectMake(0, 163, 106, 53);
[doneButton setImage:[UIImage imageNamed:@"5.png"] forState:UIControlStateNormal];
[doneButton addTarget:self action:@selector(addRadixPoint) forControlEvents:UIControlEventTouchUpInside];
// locate keyboard view
UIWindow* tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];//返回应用程序window
UIView* keyboard;
for(int i=0; i<[tempWindow.subviews count]; i++) //遍历window上的所有subview
{
keyboard = [tempWindow.subviews objectAtIndex:i];
// keyboard view found; add the custom button to it
if([[keyboard description] hasPrefix:@"<UIKeyboard"] == YES)
[keyboard addSubview:doneButton];
}
}
正则表达式使用:
被用于正则表达式的字串必须是可变长的,不然会出问题
将一个空间放在视图之上
[scrollView insertSubview:searchButton aboveSubview:scrollView];
从本地加载图片
NSString *boundle = [[NSBundle mainBundle] resourcePath];
[web1 loadHTMLString:[NSString stringWithFormat:@"<img src='http://fei263.blog.163.com/blog/0001.png'/>"] baseURL:[NSURL fileURLWithPath:boundle]];
从网页加载图片并让图片在规定长宽中缩小
[cell.img loadHTMLString:[NSString stringWithFormat:@"<html><body><img src='http://fei263.blog.163.com/blog/%@' height='90px' width='90px'></body></html>",goodsInfo.GoodsImg] baseURL:nil];
将网页加载到webview上通过javascript获取里面的数据,如果只是发送了一个连接请求获取到源码以后可以用正则表达式进行获取数据
NSString *javaScript1 = @"document.getElementsByName('.u').item(0).value";
NSString *javaScript2 = @"document.getElementsByName('.challenge').item(0).value";
NSString *strResult1 = [NSString stringWithString:[theWebView stringByEvaluatingJavaScriptFromString:javaScript1]];
NSString *strResult2 = [NSString stringWithString:[theWebView stringByEvaluatingJavaScriptFromString:javaScript2]];
用NSString怎么把UTF8转换成unicode
utf8Str //
NSString *unicodeStr = [NSString stringWithCString:[utf8Str UTF8String] encoding:NSUnicodeStringEncoding];
View自己调用自己的方法:
[self performSelector:@selector(loginToNext) withObject:nil afterDelay:2];//黄色段为方法名,和延迟几秒执行.
显示图像:
CGRect myImageRect = CGRectMake(0.0f, 0.0f, 320.0f, 109.0f);
UIImageView *myImage = [[UIImageView alloc] initWithFrame:myImageRect];
[myImage setImage:[UIImage imageNamed:@"myImage.png"]];
myImage.opaque = YES; //opaque是否透明
[self.view addSubview:myImage];
[myImage release];
WebView:
CGRect webFrame = CGRectMake(0.0, 0.0, 320.0, 460.0);
UIWebView *webView = [[UIWebView alloc] initWithFrame:webFrame];
[webView setBackgroundColor:[UIColor whiteColor]];
NSString *urlAddress = @"http://www.google.com";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
[self addSubview:webView];
[webView release];
显示网络活动状态指示符
这是在iPhone左上部的状态栏显示的转动的图标指示有背景发生网络的活动。
UIApplication* app = [UIApplication sharedApplication];
app.networkActivityIndicatorVisible = YES;
动画:一个接一个地显示一系列的图象
NSArray *myImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"myImage1.png"], [UIImage imageNamed:@"myImage2.png"], [UIImage imageNamed:@"myImage3.png"], [UIImage imageNamed:@"myImage4.gif"], nil];
UIImageView *myAnimatedView = [UIImageView alloc];
[myAnimatedView initWithFrame:[self bounds]];
myAnimatedView.animationImages = myImages; //animationImages属性返回一个存放动画图片的数组
myAnimatedView.animationDuration = 0.25; //浏览整个图片一次所用的时间
myAnimatedView.animationRepeatCount = 0; // 0 = loops forever 动画重复次数
[myAnimatedView startAnimating];
[self addSubview:myAnimatedView];
[myAnimatedView release];
动画:显示了something在屏幕上移动。注:这种类型的动画是“开始后不处理” -你不能获取任何有关物体在动画中的信息(如当前的位置) 。如果您需要此信息,您会手动使用定时器去调整动画的X和Y坐标
这个需要导入QuartzCore.framework
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.translation.x"];
//Creates and returns an CAPropertyAnimation instance for the specified key path.
//parameter:the key path of the property to be animated
theAnimation.duration=1;
theAnimation.repeatCount=2;
theAnimation.autoreverses=YES;
theAnimation.fromValue=[NSNumber numberWithFloat:0];
theAnimation.toValue=[NSNumber numberWithFloat:-60];
[view.layer addAnimation:theAnimation forKey:@"animateLayer"];
Draggable items//拖动项目
Here's how to create a simple draggable image.//这是如何生成一个简单的拖动图象
1. Create a new class that inherits from UIImageView
@interface myDraggableImage : UIImageView { }
2. In the implementation for this new class, add the 2 methods:
- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
{
// Retrieve the touch point 检索接触点
CGPoint pt = [[touches anyObject] locationInView:self];
startLocation = pt;
[[self superview] bringSubviewToFront:self];
}
- (void) touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event
{
// Move relative to the original touch point 相对以前的触摸点进行移动
CGPoint pt = [[touches anyObject] locationInView:self];
CGRect frame = [self frame];
frame.origin.x += pt.x - startLocation.x;
frame.origin.y += pt.y - startLocation.y;
[self setFrame:frame];
}
3. Now instantiate the new class as you would any other new image and add it to your view
//实例这个新的类,放到你需要新的图片放到你的视图上
dragger = [[myDraggableImage alloc] initWithFrame:myDragRect];
[dragger setImage:[UIImage imageNamed:@"myImage.png"]];
[dragger setUserInteractionEnabled:YES];
线程:
1. Create the new thread:
[NSThread detachNewThreadSelector:@selector(myMethod) toTarget:self withObject:nil];
2. Create the method that is called by the new thread:
- (void)myMethod
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
*** code that should be run in the new thread goes here ***
[pool release];
}
//What if you need to do something to the main thread from inside your new thread (for example, show a loading //symbol)? Use performSelectorOnMainThread.
[self performSelectorOnMainThread:@selector(myMethod) withObject:nil waitUntilDone:false];
Plist files
Application-specific plist files can be stored in the Resources folder of the app bundle. When the app first launches, it should check if there is an existing plist in the user's Documents folder, and if not it should copy the plist from the app bundle.
// Look in Documents for an existing plist file
NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
myPlistPath = [documentsDirectory stringByAppendingPathComponent:
[NSString stringWithFormat: @"%@.plist", plistName] ];
[myPlistPath retain];
// If it's not there, copy it from the bundle
NSFileManager *fileManger = [NSFileManager defaultManager];
if ( ![fileManger fileExistsAtPath:myPlistPath] )
{
NSString *pathToSettingsInBundle = [[NSBundle mainBundle] pathForResource:plistName ofType:@"plist"];
}
//Now read the plist file from Documents
NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectoryPath = [paths objectAtIndex:0];
NSString *path = [documentsDirectoryPath stringByAppendingPathComponent:@"myApp.plist"];
NSMutableDictionary *plist = [NSDictionary dictionaryWithContentsOfFile: path];
//Now read and set key/values
myKey = (int)[[plist valueForKey:@"myKey"] intValue];
myKey2 = (bool)[[plist valueForKey:@"myKey2"] boolValue];
[plist setValue:myKey forKey:@"myKey"];
[plist writeToFile:path atomically:YES];
Alerts
Show a simple alert with OK button.
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:
@"An Alert!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
Info button
Increase the touchable area on the Info button, so it's easier to press.
CGRect newInfoButtonRect = CGRectMake(infoButton.frame.origin.x-25, infoButton.frame.origin.y-25, infoButton.frame.size.width+50, infoButton.frame.size.height+50);
[infoButton setFrame:newInfoButtonRect];
Detecting Subviews
You can loop through subviews of an existing view. This works especially well if you use the "tag" property on your views.
for (UIImageView *anImage in [self.view subviews])
{
if (anImage.tag == 1)
{ // do something }
}
NSString *result = (NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
(CFStringRef)string,NULL,CFSTR("!*'();:@&=+$,/?%#[]"),kCFStringEncodingUTF8);
[result autorelease];
return result;
}
//生成nonce
- (NSString *)generateNonce{
CFUUIDRef theUUID = CFUUIDCreate(NULL);
CFStringRef string = CFUUIDCreateString(NULL, theUUID);
NSMakeCollectable(theUUID);
return [(NSString *)string stringByReplacingOccurrencesOfString:@"-" withString:@""];
//return (NSString *)string;
}
//生成Timestamp
- (NSString *)generateTimestamp{
return [[NSString stringWithFormat:@"%d", time(NULL)] retain];
}
iPhone键盘改变颜色
只有这2种数字键盘才有效果:UIKeyboardTypeNumberPad,UIKeyboardTypePhonePad
keyboardAppearance = UIKeyboardAppearanceAlert
代码如下:
1. NSArray *ws = [[UIApplication sharedApplication] windows];
2. for(UIView *w in ws){
3. NSArray *vs = [w subviews];
4. for(UIView *v in vs){
5. if([[NSString stringWithUTF8String:object_getClassName(v)] isEqualToString:@"UIKeyboard"]){
6. v.backgroundColor = [UIColor redColor];
7. }
8. }
9. }
从一个界面push到下一界面左上角返回按钮文字设置
在父viewController中如下设置:
UIBarButtonItem *backbutton = [[UIBarButtonItem alloc]init];
backbutton.title = @"返回列表";
self.navigationItem.backBarButtonItem = backbutton;
[backbutton release];
navigationbar的back键触发其他事件
UIButton *back =[[UIButton alloc] initWithFrame:CGRectMake(200, 25, 63, 30)];
[back addTarget:self action:@selector(reloadRowData:) forControlEvents:UIControlEventTouchUpInside];
[back setImage:[UIImage imageNamed:@"返回按钮.png"] forState:UIControlStateNormal];
UIBarButtonItem *backButtonItem = [[UIBarButtonItem alloc] initWithCustomView:back];
self.navigationItem.leftBarButtonItem = loginButtonItem
[back release];
[backButtonItem release];
防止屏幕暗掉锁屏
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
将图片从左到右翻页效果显示
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 0, 470)];
[imageView setImage:[UIImage imageNamed:@"Bg.jpg"]];
self.myImageView =imageView;
[self.view addSubview:imageView];
[imageView release];
CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:nil context:context];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.5];
[myImageView setFrame:CGRectMake(0, 0, 310, 470)];
[UIView commitAnimations];
让覆盖在下面层的视图接受触摸事件
searchImage.exclusiveTouch = YES;//第一层
searchImage.userInteractionEnabled = NO;
myMapView.exclusiveTouch = NO;//第二层
myMapView.userInteractionEnabled = YES;
View的缩放
NSValue *touchPointValue = [[NSValue valueWithCGPoint:CGPointMake(100,100)] retain];
[UIView beginAnimations:nil context:touchPointValue];
transform = CGAffineTransformMakeScale(0.1,0.21);
firstPieceView.transform = transform;
[UIView commitAnimations];
代码循环添加按钮,其他空间也可以用类似方法添加
- (void)viewDidLoad {
[super viewDidLoad];
for(int i = 0; i < 5; i++){
CGRect frame;
Btn[i] = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
[Btn[i] setImage:[UIImage imageNamed:@"Button.png"] forState:UIControlStateNormal];//设置按钮图片
frame.size.width = 55;//设置按钮坐标及大小
frame.size.height = 84;
frame.origin.x = (i%5)*57+5;
frame.origin.y = 10;
[Btn[i] setFrame:frame];
[Btn[i] setBackgroundColor:[UIColor clearColor]];
[Btn[i] addTarget:self action:@selector(btnPressed:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:Btn[i]];
[Btn[i] release];
}
}
//响应按钮事件
-(void)btnPressed:(id)sender{
for(int i = 0; i < 5;i++){
if([sender isEqual:Btn[i]]){
NSLog(@"Btn[%d]:",i);
}
}
}
去除nsstring中的空格,table 以及newline,nextline
NSCharacterSet *whitespace = [NSCharacterSet whitespaceAndNewlineCharacterSet];
NSString *username = [mUsernameField stringValue];
username = [username stringByTrimmingCharactersInSet:whitespace];
UIImagePickerController
用UIImagePickerController选择、显示图片或视频,主要注意UIImagePickerController几个属性的设置
一:UI 显示样式,显示的格式确定
1:sourceType
@property(nonatomic) UIImagePickerControllerSourceType sourceType
enum {
UIImagePickerControllerSourceTypePhotoLibrary,
UIImagePickerControllerSourceTypeCamera,
UIImagePickerControllerSourceTypeSavedPhotosAlbum
};
typedef NSUInteger UIImagePickerControllerSourceType;
sourceType用来确定用户界面显示的样式:
共三种格式(模拟器上的效果图)
UIImagePickerControllerSourceTypePhotoLibrary,
UIImagePickerControllerSourceTypeCamera,
UIImagePickerControllerSourceTypeSavedPhotosAlbum
为了区分是否支持视频格式,一般要用到下面这个函数,以便确定mediaTypes。
+ (BOOL)isSourceTypeAvailable:(UIImagePickerControllerSourceType)sourceType
2: mediaTypes
@property(nonatomic,copy) NSArray *mediaTypes
mediaTypes用来确定再picker里显示那些类型的多媒体文件,图片?视频?
+ (NSArray *)availableMediaTypesForSourceType:(UIImagePickerControllerSourceType)sourceType
二:选取动作处理
UIImagePickerControllerDelegate
通过代理来完成用户在选中图片,或者choose视频时的处理方式:
共有三个可选的代理方法
– imagePickerController:didFinishPickingMediaWithInfo:
– imagePickerControllerDidCancel:
– imagePickerController:didFinishPickingImage:editingInfo: Deprecated in iPhone OS 3.0
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
info中包括选取的照片,视频的主要信息
NSString *const UIImagePickerControllerMediaType; 选取的类型 public.image public.movie
NSString *const UIImagePickerControllerOriginalImage; 修改前的UIImage object.
NSString *const UIImagePickerControllerEditedImage; 修改后的UIImage object.
NSString *const UIImagePickerControllerCropRect; 原始图片的尺寸NSValue object containing a CGRect data type
NSString *const UIImagePickerControllerMediaURL; 视频在文件系统中 的 NSURL地址
保存视频主要时通过获取其NSURL 然后转换成NSData
实例代码如下:
- (void) pickImage: (id) sender
{
UIImagePickerController *ipc = [[UIImagePickerController alloc] init];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]){
ipc.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
ipc.mediaTypes =[UIImagePickerController availableMediaTypesForSourceType:ipc.sourceType];
}
ipc.delegate = self;
ipc.allowsImageEditing = NO;
[self presentModalViewController:ipc animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
if ([mediaType isEqualToString:@"public.image"]){
// UIImage *selectedImage = [info objectForKey:UIImagePickerControllerOriginalImage];
UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
NSLog(@"found an image");
[UIImageJPEGRepresentation(image, 1.0f) writeToFile:[self findUniqueSavePath] atomically:YES];
SETIMAGE(image);
CFShow([[NSFileManager defaultManager] directoryContentsAtPath:[NSHomeDirectory() stringByAppendingString:@"/Documents"]]);
}
else if ([mediaType isEqualToString:@"public.movie"]){
NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL];
NSLog(@"found a video");
NSData *webData = [NSData dataWithContentsOfURL:videoURL];
//NSData *video = [[NSString alloc] initWithContentsOfURL:videoURL];
[webData writeToFile:[self findUniqueMoviePath] atomically:YES];
CFShow([[NSFileManager defaultManager] directoryContentsAtPath:[NSHomeDirectory() stringByAppendingString:@"/Documents"]]);
// NSLog(videoURL);
}
[picker dismissModalViewControllerAnimated:YES];
}
UITextInputTraits属性
autocapitalizationType 设置键盘自动大小写的属性 UITextAutocapitalizationTypeNone
autocorrectionType property 设置是否有自动修改提示 UITextAutocorrectionTypeNo
enablesReturnKeyAutomatically Boolean值-设置在用户没有输入是returnKey禁用,默认值NO
keyboardAppearance 设置键盘显示方式 除了默认模式 还有一个UIKeyboardAppearanceAlert模式
keyboardType 设置键盘类型 UIKeyboardTypePhonePad 等
returnKeyType 设置renturnKey按键上的提示文字 UIReturnKeyGo UIReturnKeyNext
secureTextEntry BOOL值 -- 设置是否是密码保护模式输入
如下:
设置登录用的 输入框 UITextField
用户名输入框:
m_TF_username = [[UITextField alloc] initWithFrame:my_frame];
m_TF_username.borderStyle = UITextBorderStyleNone;
m_TF_username.clearButtonMode = UITextFieldViewModeWhileEditing;
m_TF_username.delegate = self;
m_TF_username.returnKeyType = UIReturnKeyNext;
m_TF_username.autocapitalizationType = UITextAutocapitalizationTypeNone;
[m_TF_username becomeFirstResponder];
密码输入框:
m_TF_password = [[UITextField alloc] initWithFrame:my_frame];
m_TF_password.borderStyle = UITextBorderStyleNone;
m_TF_password.clearButtonMode = UITextFieldViewModeWhileEditing;
m_TF_password.delegate = self;
m_TF_password.returnKeyType = UIReturnKeyGo;
m_TF_password.secureTextEntry =YES;
键盘透明
textField.keyboardAppearance = UIKeyboardAppearanceAlert;
状态栏的网络活动风火轮是否旋转
[UIApplication sharedApplication].networkActivityIndicatorVisible,默认值是NO。
截取屏幕图片
//创建一个基于位图的图形上下文并指定大小为CGSizeMake(200,400)
UIGraphicsBeginImageContext(CGSizeMake(200,400));
//renderInContext 呈现接受者及其子范围到指定的上下文
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
//返回一个基于当前图形上下文的图片
UIImage *aImage = UIGraphicsGetImageFromCurrentImageContext();
//移除栈顶的基于当前位图的图形上下文
UIGraphicsEndImageContext();
//以png格式返回指定图片的数据
imageData = UIImagePNGRepresentation(aImage);
更改cell选中的背景
UIView *myview = [[UIView alloc] init];
myview.frame = CGRectMake(0, 0, 320, 47);
myview.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"0006.png"]];
cell.selectedBackgroundView = myview;
在数字键盘上添加button:
//定义一个消息中心
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; //addObserver:注册一个观察员 name:消息名称
- (void)keyboardWillShow:(NSNotification *)note {
// create custom button
UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
doneButton.frame = CGRectMake(0, 163, 106, 53);
[doneButton setImage:[UIImage imageNamed:@"5.png"] forState:UIControlStateNormal];
[doneButton addTarget:self action:@selector(addRadixPoint) forControlEvents:UIControlEventTouchUpInside];
// locate keyboard view
UIWindow* tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];//返回应用程序window
UIView* keyboard;
for(int i=0; i<[tempWindow.subviews count]; i++) //遍历window上的所有subview
{
keyboard = [tempWindow.subviews objectAtIndex:i];
// keyboard view found; add the custom button to it
if([[keyboard description] hasPrefix:@"<UIKeyboard"] == YES)
[keyboard addSubview:doneButton];
}
}
正则表达式使用:
被用于正则表达式的字串必须是可变长的,不然会出问题
将一个空间放在视图之上
[scrollView insertSubview:searchButton aboveSubview:scrollView];
从本地加载图片
NSString *boundle = [[NSBundle mainBundle] resourcePath];
[web1 loadHTMLString:[NSString stringWithFormat:@"<img src='http://fei263.blog.163.com/blog/0001.png'/>"] baseURL:[NSURL fileURLWithPath:boundle]];
从网页加载图片并让图片在规定长宽中缩小
[cell.img loadHTMLString:[NSString stringWithFormat:@"<html><body><img src='http://fei263.blog.163.com/blog/%@' height='90px' width='90px'></body></html>",goodsInfo.GoodsImg] baseURL:nil];
将网页加载到webview上通过javascript获取里面的数据,如果只是发送了一个连接请求获取到源码以后可以用正则表达式进行获取数据
NSString *javaScript1 = @"document.getElementsByName('.u').item(0).value";
NSString *javaScript2 = @"document.getElementsByName('.challenge').item(0).value";
NSString *strResult1 = [NSString stringWithString:[theWebView stringByEvaluatingJavaScriptFromString:javaScript1]];
NSString *strResult2 = [NSString stringWithString:[theWebView stringByEvaluatingJavaScriptFromString:javaScript2]];
用NSString怎么把UTF8转换成unicode
utf8Str //
NSString *unicodeStr = [NSString stringWithCString:[utf8Str UTF8String] encoding:NSUnicodeStringEncoding];
View自己调用自己的方法:
[self performSelector:@selector(loginToNext) withObject:nil afterDelay:2];//黄色段为方法名,和延迟几秒执行.
显示图像:
CGRect myImageRect = CGRectMake(0.0f, 0.0f, 320.0f, 109.0f);
UIImageView *myImage = [[UIImageView alloc] initWithFrame:myImageRect];
[myImage setImage:[UIImage imageNamed:@"myImage.png"]];
myImage.opaque = YES; //opaque是否透明
[self.view addSubview:myImage];
[myImage release];
WebView:
CGRect webFrame = CGRectMake(0.0, 0.0, 320.0, 460.0);
UIWebView *webView = [[UIWebView alloc] initWithFrame:webFrame];
[webView setBackgroundColor:[UIColor whiteColor]];
NSString *urlAddress = @"http://www.google.com";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
[self addSubview:webView];
[webView release];
显示网络活动状态指示符
这是在iPhone左上部的状态栏显示的转动的图标指示有背景发生网络的活动。
UIApplication* app = [UIApplication sharedApplication];
app.networkActivityIndicatorVisible = YES;
动画:一个接一个地显示一系列的图象
NSArray *myImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"myImage1.png"], [UIImage imageNamed:@"myImage2.png"], [UIImage imageNamed:@"myImage3.png"], [UIImage imageNamed:@"myImage4.gif"], nil];
UIImageView *myAnimatedView = [UIImageView alloc];
[myAnimatedView initWithFrame:[self bounds]];
myAnimatedView.animationImages = myImages; //animationImages属性返回一个存放动画图片的数组
myAnimatedView.animationDuration = 0.25; //浏览整个图片一次所用的时间
myAnimatedView.animationRepeatCount = 0; // 0 = loops forever 动画重复次数
[myAnimatedView startAnimating];
[self addSubview:myAnimatedView];
[myAnimatedView release];
动画:显示了something在屏幕上移动。注:这种类型的动画是“开始后不处理” -你不能获取任何有关物体在动画中的信息(如当前的位置) 。如果您需要此信息,您会手动使用定时器去调整动画的X和Y坐标
这个需要导入QuartzCore.framework
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.translation.x"];
//Creates and returns an CAPropertyAnimation instance for the specified key path.
//parameter:the key path of the property to be animated
theAnimation.duration=1;
theAnimation.repeatCount=2;
theAnimation.autoreverses=YES;
theAnimation.fromValue=[NSNumber numberWithFloat:0];
theAnimation.toValue=[NSNumber numberWithFloat:-60];
[view.layer addAnimation:theAnimation forKey:@"animateLayer"];
Draggable items//拖动项目
Here's how to create a simple draggable image.//这是如何生成一个简单的拖动图象
1. Create a new class that inherits from UIImageView
@interface myDraggableImage : UIImageView { }
2. In the implementation for this new class, add the 2 methods:
- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
{
// Retrieve the touch point 检索接触点
CGPoint pt = [[touches anyObject] locationInView:self];
startLocation = pt;
[[self superview] bringSubviewToFront:self];
}
- (void) touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event
{
// Move relative to the original touch point 相对以前的触摸点进行移动
CGPoint pt = [[touches anyObject] locationInView:self];
CGRect frame = [self frame];
frame.origin.x += pt.x - startLocation.x;
frame.origin.y += pt.y - startLocation.y;
[self setFrame:frame];
}
3. Now instantiate the new class as you would any other new image and add it to your view
//实例这个新的类,放到你需要新的图片放到你的视图上
dragger = [[myDraggableImage alloc] initWithFrame:myDragRect];
[dragger setImage:[UIImage imageNamed:@"myImage.png"]];
[dragger setUserInteractionEnabled:YES];
线程:
1. Create the new thread:
[NSThread detachNewThreadSelector:@selector(myMethod) toTarget:self withObject:nil];
2. Create the method that is called by the new thread:
- (void)myMethod
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
*** code that should be run in the new thread goes here ***
[pool release];
}
//What if you need to do something to the main thread from inside your new thread (for example, show a loading //symbol)? Use performSelectorOnMainThread.
[self performSelectorOnMainThread:@selector(myMethod) withObject:nil waitUntilDone:false];
Plist files
Application-specific plist files can be stored in the Resources folder of the app bundle. When the app first launches, it should check if there is an existing plist in the user's Documents folder, and if not it should copy the plist from the app bundle.
// Look in Documents for an existing plist file
NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
myPlistPath = [documentsDirectory stringByAppendingPathComponent:
[NSString stringWithFormat: @"%@.plist", plistName] ];
[myPlistPath retain];
// If it's not there, copy it from the bundle
NSFileManager *fileManger = [NSFileManager defaultManager];
if ( ![fileManger fileExistsAtPath:myPlistPath] )
{
NSString *pathToSettingsInBundle = [[NSBundle mainBundle] pathForResource:plistName ofType:@"plist"];
}
//Now read the plist file from Documents
NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectoryPath = [paths objectAtIndex:0];
NSString *path = [documentsDirectoryPath stringByAppendingPathComponent:@"myApp.plist"];
NSMutableDictionary *plist = [NSDictionary dictionaryWithContentsOfFile: path];
//Now read and set key/values
myKey = (int)[[plist valueForKey:@"myKey"] intValue];
myKey2 = (bool)[[plist valueForKey:@"myKey2"] boolValue];
[plist setValue:myKey forKey:@"myKey"];
[plist writeToFile:path atomically:YES];
Alerts
Show a simple alert with OK button.
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:
@"An Alert!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
Info button
Increase the touchable area on the Info button, so it's easier to press.
CGRect newInfoButtonRect = CGRectMake(infoButton.frame.origin.x-25, infoButton.frame.origin.y-25, infoButton.frame.size.width+50, infoButton.frame.size.height+50);
[infoButton setFrame:newInfoButtonRect];
Detecting Subviews
You can loop through subviews of an existing view. This works especially well if you use the "tag" property on your views.
for (UIImageView *anImage in [self.view subviews])
{
if (anImage.tag == 1)
{ // do something }
}
发表评论
-
sprite list 白边
2012-01-17 11:32 876很奇怪的白边问题 就是sprite list!切图会变成白色 ... -
cocos2d 内存整理
2011-12-31 11:29 1545[[CCSpriteFrameCache sharedSp ... -
CCTransitionScene
2011-12-28 19:08 1065//淡入淡出 CCFadTransition *tran = ... -
OpenGL draw base functions
2011-12-28 19:04 2017-(void) draw { CGSize s = [[C ... -
(转)cocos2d的常用动作及效果总结之五:Animation
2011-12-12 15:57 0这一篇是讲一下如何在cocos2d中实现动画。 实现动画的步 ... -
(转)cocos2d的常用动作及效果总结之四:Special Actions
2011-12-12 15:53 2016Special Actions 个人理解包含三部分,一个是函数 ... -
(转)cocos2d的常用动作及效果总结之三:Ease actions
2011-12-12 15:51 6333Ease actions 影响的是动作的时间线性。 举个例子 ... -
cocos2d的常用动作及效果总结之二:Composition actions
2011-12-12 15:49 1975上一篇整理了 basice action 基本动作的部分,这 ... -
(转)cocos2d的常用动作及效果总结之一: Basic actions
2011-12-12 15:47 3617在官方网站上,对cocos2d ... -
xcode 4 Add Existing Framework
2011-11-14 11:52 1282现在的记性十分不好!老是记不住xcode 4如何Add Exi ... -
(转)iphone应用开发:发送短信/邮件/打电话
2011-11-10 10:46 1231+ (void) makeCall:(NSString *)p ... -
cocos2d 添加 原生得空间的类:CCUIViewWrapper 的用法
2011-11-03 11:55 1959UIView *myView = [[[UIView allo ... -
【转】【Cocos2d游戏开发之一】多触点与触屏事件详解(单一监听、事件分发)
2011-09-20 11:46 1447原文地址:http://blog.csdn ... -
cocos2d 的一些实用代码
2011-09-15 10:51 23441.问题描述: 如果我想让一个 sprite 显示3秒钟然后消 ... -
mac 的一些基本操作
2011-09-08 13:34 8591.寻找共享文件: 以前在windows上输入:\\192 ... -
[转]Cocos2D的4个基本概念
2011-09-06 18:35 1852开发cocos2d 应用程序,必须先了解如下4个概念: Sce ... -
iphone 升级到4.3.3 编译出现的问题
2011-05-25 15:46 1853unable to load symbol file: una ... -
iphone sdk 更新
2011-05-25 12:01 1215ipad被升级到4.3.3版本,但是使用device测试的时候 ... -
iphone in-app-purchase 注意的地方
2011-05-24 12:03 2084使用apple in-app-purchase 还是很麻烦! ... -
iphone 开发的一些错误 与答案
2011-05-23 17:47 8151。local declaration of 'delegat ...
相关推荐
本主题聚焦于“iPhone开发常用代码”,我们将探讨一些在实际项目中经常使用的代码片段和概念,这些对于任何iOS开发者来说都是至关重要的。 1. **Swift基础** Swift是Apple在2014年推出的一种现代化、安全的编程...
iphone常用代码段,适合新手学习使用
### iPhone开发常用代码知识点 #### 一、更改Cell选中背景 在iOS开发过程中,我们经常需要自定义UITableViewCell(单元格)的样式,包括改变选中状态时的背景颜色或图像。下面是一段示例代码: ```objective-c ...
### iPhone常用代码集合详解 #### 图片处理代码 在iOS开发中,经常需要对图片进行裁剪或处理。以下代码展示了如何使用`UIImage`和Core Graphics框架中的`CGImageCreateWithImageInRect`函数来获取一张图片的部分...
标题与描述中的“iOS开发常用代码”涉及到的是iOS应用程序开发中的常见编程实践和技术要点,主要聚焦于使用Objective-C或Swift语言进行UIKit框架下的界面元素定制和优化。以下将详细解析和扩展这部分内容所涵盖的...
《iPhone开发入门经典》源代码解析 在移动应用开发领域,iOS平台凭借其优秀的用户体验和庞大的用户基础,一直是开发者关注的焦点。对于初学者来说,掌握iPhone应用开发是开启这一领域的钥匙。本教程将深入探讨...
在iOS应用开发中,尤其是针对iPhone的开发,掌握常用控件的使用是至关重要的。这些控件构成了用户界面的基础,提供了与用户交互的各种方式。以下是对压缩包内各个PDF文件所对应控件的详细说明: 1. **UIView_Class....
### iPhone开发常用库UIKit_Framework知识点解析 #### 一、UIKit Framework概述 - **定义与作用:** `UIKit` 是苹果公司为iOS应用开发提供的一套核心框架,它包含了用于构建用户界面的各种类和方法。通过这个框架...
总结来说,"iphone开发 程序生成雷电代码"涉及到的知识点包括:iOS开发环境(Objective-C/Swift)、图形渲染技术(OpenGL ES/Metal)、动画框架(Core Animation)、随机数与噪声函数的应用、性能优化以及实际项目的...
总之,SQLite3是iPhone开发中常用的数据存储解决方案,通过封装好的类库,我们可以更高效地进行数据库操作。"database.sqlite3"提供的源代码可能就是一个这样的工具,它简化了开发过程,让开发者能更专注于应用的...
总之,这个压缩包提供的源代码将覆盖了从界面设计、数据处理到系统级功能的多个关键领域,对于想要深入学习iPhone开发的人来说,无疑是一份宝贵的资源。通过分析和实践这些代码,开发者不仅可以巩固理论知识,还能...
【标题解析】:“IOS应用源码之iPhone开发秘笈随书代码.zip”这一标题表明了这是一个与iOS应用程序开发相关的资源包,特别是针对iPhone平台。它很可能是某本关于iOS开发书籍的配套代码示例,书名可能为“iPhone开发...
《iPhone开发基础教程》是一本面向初学者的iOS开发指南,源代码的提供旨在帮助读者更深入地理解和实践iOS应用开发。在这个教程中,我们将主要探讨如何使用Apple的Swift编程语言以及Xcode集成开发环境(IDE)来创建...
《iOS编程揭秘:iPhone与iPad应用开发入门教材源代码》是一本专为初学者设计的教程,旨在引导读者深入理解并掌握iOS应用开发的核心技术。该书以iOS 6为开发环境,涵盖了从基础概念到高级特性的全方位知识。通过本书...
这里我们探讨的是一个关于“搜集iPhone开发的6个程序源代码”的主题,这将包括一些已发布的iPhone游戏的源码。这些源代码可以作为学习、理解和优化iOS应用开发的宝贵资源。 首先,我们要明确iPhone开发主要基于...
### 新手入门常用的iPhone代码知识点 #### 一、概述 对于初学者而言,掌握一些基本的iOS编程技巧是非常重要的。本文将围绕一个标题为“新手入门常用的iPhone代码”的主题进行展开,详细介绍其中提及的一些基本操作...
- **iPhone开发**:这显然指整个iOS应用开发,包括使用Swift或Objective-C编程语言,以及Xcode集成开发环境(IDE)。 - **源代码**:这表明提供的压缩包可能包含了应用的完整源代码,这对于学习者来说是一份宝贵的...
考虑到iPhone3是指的是较早期的iPhone型号(如iPhone 3G或iPhone 3GS),这本教程可能主要面向的是iOS 3或更早版本的操作系统。因此,在学习时需要注意这些基础知识在现代iOS版本中的适用性。 #### 1.2 描述解读 ...
iPhone应用开发从入门到精通作者:杨帆 郑青青 王凤筱 编著前 言入 门 篇第1章 iPhone OS介绍 21.1 iPhone OS预览21.1.1 iPhone OS的发展历史21.1.2 iPhone OS的外观31.1.3 多任务特性31.1.4 不支持的技术...