锘??xml version="1.0" encoding="utf-8" standalone="yes"?> 閫氳繃浠g爜鍒涘緩 涓涓猆INavigationcontroller鍖呮嫭 navigation bar,鍙夌殑navigation toolbar,RootViewController. 鏈夊洓涓柟娉?/p>
鍙兘澶у鎯崇洿鎺ヨ闂畁avigationcontroller 鐨刵avigation bar銆備絾鏄氬父鎴戜滑涓嶈繖鏍峰仛銆傝屾槸緇存姢姣忎釜viewcontroller鐨?navigation item銆?/p>
榪欓噷涓嶈灝唍avigation item 涓?navigation bar 娣鋒穯錛宯avigation item涓嶆槸UIView鐨勫瓙綾匯傚畠鏄竴涓敤鏉ユ洿鏂皀avigtion bar鐨勫瓨鍌ㄤ俊鎭殑綾匯?/p>
榪樻槸涓婁唬鐮佽鏄? 瑕佹敞鎰忎袱鐐?1.鎴戜滑騫舵病鏈夌洿鎺ユ搷浣渘avigation bar 2.鍦╬ush 鏂扮殑controller涔嬪墠璁劇疆鏍囬 褰撴柊鐨刣etailcontroller琚玴ush鍚庯紝UINavigationController浼氳嚜鍔ㄦ洿鏂皀avigation bar銆?/p>
榛樿鎯呭喌涓嬶紝褰撲綘灝嗕竴涓柊鐨剉iewcontroller鎺ㄥ叆鏍堢殑鏃跺欙紝榪斿洖鎸夐挳灝嗘樉紺哄墠涓涓〉闈㈢殑controller鐨?navigation item鐨則itle銆?/p>
濡傛灉鎯沖畾鍒惰繑鍥炴寜閽殑鏍囬榪樻湁浜嬩歡鐨勮瘽錛屽彲浠ョ敤浠ヤ笅浠g爜銆?/p>
娉ㄦ剰錛岃繖閲岀殑self鏄涓綰х殑view controller銆傝繖鏍風殑璇濈浜岀駭鐨勯〉闈㈠皢鏄劇ず“Back” navigation item榪樻湁涓や釜灞炴eftBarButtonItem rightBarButtonItem銆?/p>
涓鑸琹eftBarButtonItem鍙嚭鐜板湪RootviewController涓嬌鐢紝鍥犱負鍏朵粬欏甸潰涓鑸兘鏄劇ず涓涓繑鍥炴寜閽?/p>
榪欎細鍦ㄥ彸渚ф坊鍔犱竴涓?#8220;Setting”鐨勬寜閽紝騫惰Е鍙慼andleSetting浜嬩歡銆?/p>
榪欑瘒鏂囩珷緲昏瘧鑷?a >http://www.iosdevnotes.com/2011/03/uinavigationcontroller-tutorial/
閫氳繃xib鍒涘緩
2.瀵艱埅鏍?/h1>
渚嬪錛屾兂鎺ㄨ繘涓涓柊鐨剉iewcontroller錛屽埌瀵艱埅鏍堜腑,浠g爜錛?
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[[tableView cellForRowAtIndexPath:indexPath] setSelected:NO animated:YES];//1.
DetailsViewController *detailsViewController = [[DetailsViewController alloc]
initWithNibName:@"DetailsViewController" bundle:nil];
[self.navigationController pushViewController:detailsViewController];
[detailsViewController release];
}
榪欓噷鏈変袱涓渶瑕佹敞鎰忕殑鍦版柟
1.榪涘叆涓嬩竴涓〉闈㈢殑鏃跺欙紝table涓殑閫夋嫨琛岃鍙栨秷銆?
2.璁板緱release瑕乸ush鐨刢ontroller.鍥犱負瀵艱埅鏍堟槸retain鐨勩?
3.閰嶇疆Navigation bar
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[[tableView cellForRowAtIndexPath:indexPath] setSelected:NO animated:YES];
Person *person;
// Some code that sets person based on the particular cell that was selected
DetailsViewController *detailsViewController = [[DetailsViewController alloc]
initWithNibName:@"DetailsViewController" bundle:nil];
detailsViewController.navigationItem.title = person.name;
[self.navigationController pushViewController:detailsViewController];
[detailsViewController release];
}
detailsViewController.navigationItem.title = person.name;榪欏彞璇濈殑鎰忔濆氨鏄妸浜岀駭鐣岄潰鐨勫鑸爣棰樿緗垚person.name
4.榪斿洖鎸夐挳
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back"
style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationItem.backBarButtonItem = backButton;
[backButton release];
5.宸﹀彸鎸夐挳
UIBarButtonItem *settingsButton = [[UIBarButtonItem alloc] initWithTitle:@"Settings"
style:UIBarButtonItemStylePlain target:self action:@selector(handleSettings)];
self.navigationItem.rightBarButtonItem = settingsButton;
[settingsButton release];
6.鍦ㄩ欏甸殣钘廚avigation Bar
鍦≧ootViewController.m涓疄鐜板涓嬶細
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:YES];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
]]>
//灝?/span>Foundation(NSDictionary銆?/span>NSData) 杞崲涓?/span>JSon鏍煎紡鐨?/span>NSData 鐢ㄦ潵鍙戦?/span>
//+ dataWithJSONObject:options:error:
//灝?/span>JSON鏍煎紡鐨?/span>Data杞崲涓?/span>Foundation(NSDictionary銆?/span>NSData) 鐢ㄦ潵瑙f瀽
//+ JSONObjectWithData:options:error:
code:
UI灝變笉璇翠簡錛屾瘮杈冪畝鍗曘傝創涓涓嬪叧閿唬鐮侊紝鍏蜂綋鐨勮瘽榪樻槸鍘葷湅婧愪唬鐮?姝f兂鍔炴硶浼狅紝鎴戣繖git鍑虹偣闂)銆?/p>
聽
/*鏍規嵁璺緞鍒涘緩鏁版嵁搴撳茍鍒涘緩涓涓〃contact(id nametext addresstext phonetext)*/
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
聽
NSString *docsDir;
NSArray *dirPaths;
聽
// Get the documents directory
dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
聽
docsDir = [dirPaths objectAtIndex:0];
聽
// Build the path to the database file
databasePath = [[NSString alloc] initWithString: [docsDir stringByAppendingPathComponent: @"contacts.db"]];
聽
NSFileManager *filemgr = [NSFileManager defaultManager];
聽
if ([filemgr fileExistsAtPath:databasePath] == NO)
{
const char *dbpath = [databasePath UTF8String];
if (sqlite3_open(dbpath, &contactDB)==SQLITE_OK)
{
char *errMsg;
const char *sql_stmt = "CREATE TABLE IF NOT EXISTS CONTACTS(ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT, ADDRESS TEXT,PHONE TEXT)";
if (sqlite3_exec(contactDB, sql_stmt, NULL, NULL, &errMsg)!=SQLITE_OK)
{
status.text = @"鍒涘緩琛ㄥけ璐?/span>\n";
}
}
else
{
status.text = @"鍒涘緩/鎵撳紑鏁版嵁搴撳け璐?/span>";
}
}
聽
}
聽
/*灝嗘暟鎹繚瀛樺彧鏁版嵁搴擄紝褰撴寜涓嬩繚瀛樻寜閽殑鏃跺?/
聽
- (IBAction)SaveToDataBase:(id)sender
{
sqlite3_stmt *statement;
聽
const char *dbpath = [databasePath UTF8String];
聽
if (sqlite3_open(dbpath, &contactDB)==SQLITE_OK) {
NSString *insertSQL = [NSString stringWithFormat:@"INSERT INTO CONTACTS (name,address,phone) VALUES(\"%@\",\"%@\",\"%@\")",name.text,address.text,phone.text];
const char *insert_stmt = [insertSQL UTF8String];
sqlite3_prepare_v2(contactDB, insert_stmt, -1, &statement, NULL);
if (sqlite3_step(statement)==SQLITE_DONE) {
status.text = @"宸插瓨鍌ㄥ埌鏁版嵁搴?/span>";
name.text = @"";
address.text = @"";
phone.text = @"";
}
else
{
status.text = @"淇濆瓨澶辮觸";
}
sqlite3_finalize(statement);
sqlite3_close(contactDB);
}
}
聽
/*鏍規嵁杈撳叆鐨勫鍚嶆潵鏌ヨ鏁版嵁*/
- (IBAction)SearchFromDataBase:(id)sender
{
const char *dbpath = [databasePath UTF8String];
sqlite3_stmt *statement;
聽
if (sqlite3_open(dbpath, &contactDB) == SQLITE_OK)
{
NSString *querySQL = [NSString stringWithFormat:@"SELECT address,phone from contacts where name=\"%@\"",name.text];
const char *query_stmt = [querySQL UTF8String];
if (sqlite3_prepare_v2(contactDB, query_stmt, -1, &statement, NULL) == SQLITE_OK)
{
if (sqlite3_step(statement) == SQLITE_ROW)
{
NSString *addressField = [[NSString alloc] initWithUTF8String:(const char *)sqlite3_column_text(statement, 0)];
address.text = addressField;
聽
NSString *phoneField = [[NSString alloc] initWithUTF8String:(const char *)sqlite3_column_text(statement, 1聽 聽 )];
phone.text = phoneField;
聽
status.text = @"宸叉煡鍒扮粨鏋?/span>";
[addressField release];
[phoneField release];
}
else {
status.text = @"鏈煡鍒扮粨鏋?/span>";
address.text = @"";
phone.text = @"";
}
sqlite3_finalize(statement);
}
聽
sqlite3_close(contactDB);
}
}
涓句釜渚嬪瓙錛屽姞鍏ュ璞鏃犳硶澶勭悊娑堟伅fun錛岃屽璞鍙互澶勭悊錛屾鏃禔宸茬粡緇ф壙浜庣被C錛屾墍浠ユ鏃禔涓嶈兘鍐嶇戶鎵緽銆傛垜浠彲浠ョ敤娑堟伅杞彂鐨勬柟寮忥紝鏉ュ皢娑堟伅杞彂緇欒兘澶熷鐞唂un娑堟伅鐨勫璞銆?/span>
褰撶劧鍙互榪欎箞瀹炵幇
|
榪欐牱綆鍗曠殑灝嗘秷鎭漿鍙戝嚭鍘伙紝浣嗘槸姝ゆ柟寮忔瑺濡ワ紝鐗瑰埆鏄綋寰堝娑堟伅閮借A鏉ュ鐞嗭紝浣嗘槸A鍙堟棤娉曞鐞嗙殑鏃跺欙紝浣犻渶瑕佸疄鐜板悇縐峟un鏉ユ彁渚涙瘡涓縐嶆柟娉曞鐞嗘柟寮忋傚茍涓斿綋鍐欎笅浠g爜鐨勬椂鍊欙紝鎵鑳藉鐞嗙殑娑堟伅闆嗗悎涔熷氨蹇呴』紜畾涓嬫潵錛屼篃灝辨槸璇存槸闈欐佺殑銆?/span>
鏈変竴縐嶈В鍐蟲柟妗堝彲浠ヨВ鍐蟲闂 : forwardInvocation錛氭柟娉曪紝姝ゆ柟娉曠戶鎵夸笌NSObject銆備笉榪嘚SObject涓鏂規硶鐨勫疄鐜幫紝鍙槸綆鍗曠殑璋冪敤浜?span style="color: #666666; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: #ffffff; display: inline !important; float: none;">doesNotRecognizeSelector:
鎴戜滑瑕佸仛鐨勬槸閲嶅啓闇瑕佽漿鍙戞秷鎭殑綾籄鐨?span style="color: #666666; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: #ffffff; display: inline !important; font-family: 'Hiragino Sans GB'; font-size: 13px;">forwardInvocation鏂規硶錛屼互瀹炵幇灝嗘秷鎭漿鍙戠粰鑳藉鐞唂un娑堟伅鐨勫璞°?/span>
- (void)forwardInvocation:(NSInvocation *)anInvocation |
{ |
if ([B respondsToSelector:[anInvocation selector]) |
[anInvocation B]; |
else |
[super forwardInvocation:anInvocation]; |
} |
榪樻湁鍏抽敭涓姝ワ紝鏄噸鍐?span style="color: #000000; font-family: Arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 26px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: #ffffff; display: inline !important; float: none;">methodSignatureForSelector鏂規硶錛屾鏂規硶鏄湪鍚戝璞″彂閫佷笉鑳藉鐞嗙殑娑堟伅鐨勬椂鍊欒皟鐢ㄧ殑錛屾鏂規硶鍙垽鏂秷鎭痜un鏄惁鏈夋晥娉ㄥ唽銆傚鏋滄敞鍐岃繃fun錛岄偅涔堝垯榪斿洖fun娑堟伅鐨勫湴鍧涔嬬被鐨勪俊鎭紝濡傛灉鏃犳晥鍒欒繑鍥瀗il錛岄偅涔堝氨crash鎺夈傛墍浠ユ垜浠鎶奻un娑堟伅娉ㄥ唽涓轟竴涓湁鏁堢殑銆?/span>
|
榪欐牱涓鏉ワ紝娑堟伅fun灝嗚杞彂鑷矪銆?/p>
鎴戜滑鏉ヨ涓涓嬪悜涓涓璞″彂閫佹秷鎭悗錛岀郴緇熺殑澶勭悊嫻佺▼
1.棣栧厛鍙戦佹秷鎭痆A fun];
2.緋葷粺浼氭鏌鑳藉惁鍝嶅簲榪欎釜fun娑堟伅錛屽鏋滆兘鍝嶅簲鍒橝鍝嶅簲
3.濡傛灉涓嶈兘鍝嶅簲錛屽垯璋冪敤methodSignatureForSelector:鏉ヨ闂繖涓秷鎭槸鍚︽湁鏁堬紝鍖呮嫭鍘葷埗綾諱腑璇㈤棶銆?/p>
4.鎺ョ潃璋冪敤forwardInvocation:姝ゆ椂姝ラ涓夎繑鍥瀗il鎴栬呭彲浠ュ鐞嗘秷鎭殑娑堟伅鍦板潃銆傚鏋渘il鍒檆rash錛屽鏋滄湁鍙互澶勭悊fun娑堟伅鐨勫湴鍧錛岄偅涔堣漿鍙戞垚鍔熴?/p>
聽
聽
1.Interface Buider
2.鐢ㄤ唬鐮佸疄鐜板湪loadview涓?/p>
3.loadview涓姞杞絰ib鏂囦歡錛屽皢瀵硅薄瑙f瀽
1.1瀹氫箟鍗忚:
鍒涘緩涓涓?h鏂囦歡
1: _MyProtocolName.h2: @protocol MyProtocolName <NSObject>3: @end
娉?鍗忚涓病鏈夊彉閲?
<NSObject>鏄唬琛ㄥ湪姝ゅ0鏄庣殑鍗忚鏄疦SObject鍗忚鐨勮鐢熷崗璁紙涓嶆槸NSObject綾?;
1.2浣跨敤鍗忚:
1: @interface CustomView:UIView<MyProtocolName>
浠h〃CustomView閬靛驚鎴戜滑鍒跺畾鐨勮繖涓崗璁紝闇瑕佸疄鐜板崗璁殑鏂規硶
1.3鐢ㄥ崗璁慨楗板彉閲?
濡傛灉榪欐牱瀹氫箟涓涓彉閲?
1: id<MyProtocolName>myNewVariable;
閭d箞myNewVaiable鏄伒寰垜浠埗瀹氱殑榪欎釜MyProtocolName鍗忚鐨?/p>
濡傛灉瀹氫箟鍑芥暟鏃?
1: - (void) doSomethingWithThisObject: (id<MyProtocolName>) aObject
閭d箞榪欎釜鍑芥暟鐨勫弬鏁版槸闇瑕侀伒寰垜浠埗瀹氱殑榪欎釜MyProtocolName鍗忚鐨?/p>
============鎺ヤ笅鏉ョ湅涓嬪浣曞埄鐢ㄥ崗璁疄鐜板鎵?========
鐩殑錛氬皢A鐨勪簨鎯呭鎵樼粰B鏉ュ仛
姝ラ1.鍦ˋ涓0鏄庡崗璁紝鍗寵濮旀墭鍑哄幓鐨勪簨鎯咃紙鏂規硶錛夈?br /> 姝ラ2.A涓0鏄庝竴涓鎵樺璞★紝鍗寵濮旀墭緇欒皝鍘誨姙錛岀敤id<鍗忚鍚嶅瓧>濮旀墭瀵硅薄鍚嶏紱
姝ラ3.姣斿鎯寵B鍋欰鐨勪簨鎯咃紝閭d箞B鐨刬nterface涓瀹e竷鑷繁閬靛驚A涓埗瀹氱殑閭d釜鍗忚銆?br /> 姝ラ4.A璋冪敤濮旀墭鎵ц閭d歡浜嬫儏鍘?鍗砙delegate fun]
A.h------------------------------------------------
@protocol Mydelegate//鍗忚鐨勫0鏄?/p>
-(void)Fun;
@end
@interface A:NSObject
{
id<Mydelegate> delegate;//澹版槑涓涓鎵樺璞★紝鎴戜滑瑕佹妸浜嬫儏濮旀墭緇欏疄鐜癕ydelegate鍗忚鐨勭被
}
@property(assign,nonatomic) id<Mydelegate> delegate;
@end
A.m---------------------------------------------
@implementation
-(void)init
{
delegate = B;
}
-(void)FunToOther
{
[delegate Fun];//灝嗘秷鎭彂閫佺粰濮旀墭鍘誨鐞?/p>
}
@end
濮旀墭瀵硅薄鐨勫疄鐜?/p>
B.h---------------------------------------------
#import"A.h"
@interface B:NSObject<MyDelegate>
@end
B.m---------------------------------------------
@implementation
-(void)fun
{
//瀹炵幇Mydelegate涓埗瀹氱殑鏂規硶
}
@end
榪欐牱鐨勮瘽A灝卞彲浠ュ鎵楤鍘誨仛fun榪欎歡浜嬫儏浜嗐?/p>
1: typedef struct _NSRange
2:
3: {
4:
5: unsigned int location;
6:
7: usingned int length;
8:
9: }NSRange;
涓夌鍒涘緩NSRange鐨勬柟娉曪細
1: 1.NSRange range;
2:
3: range.location = 17;
4:
5: range.length = 4;
6:
7: 2.NSRange range = {17,4};
8:
9: 3.NSRange range = NSMakeRange(17,4);
2.NSPoint NSSize NSRect
1: typedef struct _NSPoint
2: {
3: float x;
4: float y;
5: }NSPoint;
6:
7: typedef struct _NSSize
8: {
9: float width;
10: float height;
11: }NSSize;
12:
13: typedef struct _NSRect
14: {
15: NSPoint origin;
16: NSSize size;
17: }NSRect;
鍒涘緩鏂規硶:NSMakePoint();NSMakeSize();NSMakeRect();
//浠ヤ笂鍑犱釜鏁版嵁綾誨瀷涓嶆槸瀵硅薄鑰屾槸struct錛屽師鍥犳槸鍥犱負婊¤凍鎬ц兘闇姹傘?
3.NSString NSMutableString
鍒涘緩鏂規硶:
1: + (id)stringWithFormat:(NSString *)format, ...
2:
3: NSString *height;
4: height = [NSString initWithFormat:@"Your height is %d feet",5];
5:
鍒涘緩鏂規硶:
1: NSMutableString *string;
2:
3: string = [NSMutableString stringWithCapacity:42];
4.NSArray NSMutableArray
鐢ㄦ潵瀛樺偍Objective-C鐨勫璞★紝鑰屼笉鑳藉瓨鍌–璇█涓殑鍩烘湰鏁版嵁綾誨瀷.
鍒涘緩鏂規硶:
1: + (id)arrayWithObjects:(id)firstObj, ...
2:
3: NSArray *array;
4: array = [NSArray arrayWithObjects:@"one",@"two",@"three",nil];
1: NSEnumerator *enumerator
2: enumerator = [array objectEnumerator];
3:
4: id thingie;
5: while(thingie = [enumerator nextObject])
6: {
7: NSLog(@"i found %@",thingie);
8: }
1: for(NSString *string in array)
2: {
3: NSLog(@"i found %@",string);
4: }
6.NSDictionary
鍒涘緩鏂規硶錛?/p>
+(id)dictionaryWithObjectAndKeys:(id)fristObject,...;
娣誨姞鍏冪礌錛?/p>
-(void)setObject:(id)anObject forkey:(id)akey;
(fuck!!鍐欏埌榪欙紝windows live writer鎶ラ敊錛屽悗闈㈠啓鐨勯兘娌′繚瀛樷?
7.NSNumber
8.NSValue
9.NSNull
鈥撀爏ortedArrayHint
鈥撀爏ortedArrayUsingFunction:context:
鈥撀爏ortedArrayUsingFunction:context:hint:
鈥撀爏ortedArrayUsingDescriptors:
鈥撀爏ortedArrayUsingSelector:
鈥撀爏ortedArrayUsingComparator:
鈥撀爏ortedArrayWithOptions:usingComparator:
聽
A selector that identifies the method to use to compare two elements at a time. The method should returnNSOrderedAscending
if the receiving array is smaller than the argument,聽NSOrderedDescending
if the receiving array is larger than the argument, and聽NSOrderedSame
if they are equal.
//selector瀹氫箟浜嗕竴涓瘮杈冧袱涓暟緇勫厓绱犵殑鏂規硶錛屽鏋滄鏂規硶榪斿洖NSOrderedAscending璇存槑姝ゅ厓绱犳瘮鍙傛暟鍏冪礌灝忥紝濡傛灉榪斿洖
NSOrderedDescending璇存槑鎺ユ敹鐨勬暟緇勫厓绱犳瘮鍙傛暟鍏冪礌澶э紝NSOrderedSame鐩哥瓑銆?/code>
NSArray *sortedArray = |
[anArray sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; |
娉細蹇呴』寰椾粠鐢寵鏈哄櫒涓婂鍑簆rivate key.鍒板叾浠栨満鍣ㄤ笂
涓銆佹垚鍛樹粙緇?/span>
1.聽聽聽聽Certification(璇佷功)
璇佷功鏄鐢佃剳寮鍙戣祫鏍肩殑璁よ瘉錛屾瘡涓紑鍙戣呭笎鍙鋒湁涓濂楋紝鍒嗕負涓ょ錛?/span>
1)聽聽聽聽Developer Certification(寮鍙戣瘉涔?
瀹夎鍦ㄧ數鑴戜笂鎻愪緵鏉冮檺錛氬紑鍙戜漢鍛橀氳繃璁懼榪涜鐪熸満嫻嬭瘯銆?/span>
鍙互鐢熸垚鍓湰渚涘鍙扮數鑴戝畨瑁咃紱
2)聽聽聽聽聽聽Distribution Certification(鍙戝竷璇佷功)
瀹夎鍦ㄧ數鑴戜笂鎻愪緵鍙戝竷iOS紼嬪簭鐨勬潈闄愶細寮鍙戜漢鍛樺彲浠ュ埗鍋氭祴璇曠増鍜屽彂甯冪増鐨勭▼搴忋?/span>
涓嶅彲鐢熸垚鍓湰錛屼粎鏈夐厤緗璇佷功鐨勭數鑴戞墠鍙嬌鐢紱錛堝壇鏈埗鍋氫粙緇嶅湪涓嬮潰Keychain涓粙緇嶏級
2.聽聽聽聽Provisioning Profile(鎺堟潈鏂囦歡)
鎺堟潈鏂囦歡鏄璁懼濡俰Pod Touch銆乮Pad銆乮Phone鐨勬巿鏉冿紝鏂囦歡鍐呰褰曠殑鏄澶囩殑UDID鍜岀▼搴忕殑App Id錛屽嵆浣胯鎺堟潈鐨勮澶囧彲浠ュ畨瑁呮垨璋冭瘯Bundle identifier涓庢巿鏉冩枃浠朵腑璁板綍鐨凙pp Id瀵瑰簲鐨勭▼搴忋?/span>
寮鍙戣呭笎鍙峰湪鍒涘緩鎺堟潈鏂囦歡鏃跺欎細閫夋嫨App Id錛岋紙寮鍙戣呭笎鍙蜂笅App Id涓坊鍔狅紝鍗曢夛級鍜孶DID錛堝紑鍙戣呭笎鍙蜂笅Devices涓坊鍔犳渶澶?00涓紝澶氶夛級銆?/span>
鎺堟潈鏂囦歡鍒嗕負涓ょ錛屽搴旂浉搴旂殑璇佷功浣跨敤錛?/span>
1)聽聽聽聽Developer Provisioning Profile(寮鍙戞巿鏉冩枃浠?
鍦ㄨ鏈夊紑鍙戣瘉涔︽垨鍓湰鐨勭數鑴戜笂浣跨敤錛屽紑鍙戜漢鍛橀夋嫨璇ユ巿鏉冩枃浠墮氳繃鐢佃剳灝嗙▼搴忓畨瑁呭埌鎺堟潈鏂囦歡璁板綍鐨勮澶囦腑錛屽嵆鍙繘琛岀湡鏈烘祴璇曘?/span>
娉ㄦ剰錛氱‘淇濈數鑴戞湁鏉冮檺鐪熸満璋冭瘯錛屽嵆瀹夎浜嗗紑鍙戣瘉涔︽垨鍓湰錛涘湪寮鍙戝伐鍏蜂腑紼嬪簭鐨凚undle identifier鍜岄変腑浣跨敤鐨勬巿鏉冩枃浠剁殑App Id瑕佷竴鑷達紱榪炴帴璋冭瘯鐨勮澶囩殑UDID鍦ㄩ変腑鐨勬巿鏉冩枃浠朵腑鏈夎褰曘?/span>
2)聽聽聽聽Distribution Provisioning Profile(鍙戝竷鎺堟潈鏂囦歡)
鍦ㄨ鏈夊彂甯冭瘉涔︾殑鐢佃剳涓婏紙鍗抽厤緗瘉涔︾殑鐢佃剳錛屽彧鏈変竴鍙幫級鍒跺仛嫻嬭瘯鐗堝拰鍙戝竷鐗堢殑紼嬪簭銆?/span>
鍙戝竷鐗堝氨鏄彂甯冨埌App Store涓婄殑紼嬪簭鏂囦歡錛屽紑鍙戣呭笎鍙峰垱寤烘巿鏉冩枃浠舵椂閫夋嫨store閫夐」錛岄夋嫨App Id錛屾棤闇閫夋嫨UDID錛?/span>
嫻嬭瘯鐗堝氨鏄湪鍙戝竷涔嬪墠浜ょ粰嫻嬭瘯浜哄憳鍙悓姝ュ埌璁懼涓婄殑紼嬪簭鏂囦歡錛屽紑鍙戣呭笎鍙峰垱寤烘巿鏉冩枃浠舵椂閫夋嫨AdHoc錛岄夋嫨App Id鍜孶DID錛涘彧鏈夐変腑鐨刄DID瀵瑰簲鐨勮澶囨墠鍙兘瀹夎涓婇氳繃璇ユ巿鏉冩枃浠跺埗鍋氱殑紼嬪簭銆?/span>
3.聽聽聽聽Keychain(寮鍙戝瘑閽?
瀹夎璇佷功鎴愬姛鐨勬儏鍐典笅璇佷功涓嬮兘浼氱敓鎴怟eychain錛屼笂闈㈡彁鍒扮殑璇佷功鍓湰灝辨槸閫氳繃閰嶇疆璇佷功鐨勭數鑴戝鍑篕eychain錛堝氨鏄?p12鏂囦歡錛夊畨瑁呭埌鍏朵粬鏈哄瓙涓婏紝璁╁叾浠栨満瀛愬緱鍒拌瘉涔﹀搴旂殑鏉冮檺銆侱eveloper Certification灝卞彲浠ュ埗鍋氬壇鏈琄eychain鍒嗗彂鍒板叾浠栫數鑴戜笂瀹夎錛屼嬌鍏跺彲浠ヨ繘琛岀湡鏈烘祴璇曘?/span>
娉ㄦ剰錛欴istribution Certification鍙湁閰嶇疆璇佷功鐨勭數鑴戞墠鍙嬌鐢紝鍥犳鍗充嬌瀵煎嚭瀵煎嚭Keychain瀹夎鍒板叾浠栫數鑴戜笂錛屽叾浠栫數鑴戜篃涓嶅彲鑳藉叿鏈夎瘉涔︾殑鏉冮檺銆?/span>
These attributes specify whether or not a property has an associated set accessor. They are mutually exclusive.
@synthesize
directive in the implementation block, only the getter method is synthesized. Moreover, if you attempt to assign a value using the dot syntax, you get a compiler error.copy
Specifies that a copy of the object should be used for assignment.The previous value is sent a release
message.The copy is made by invoking the copy
method. This attribute is valid only for object types, which must implement the NSCopying
protocol.NSInteger
and CGRect
.retain
should be invoked on the object upon assignment.The previous value is sent a release
message.
A: In my multithreading OpenGL ES application, I load textures (or vertices) on a secondary thread then draw them onto screen on the main thread. Occasionally I see blank images or application freezes. What could be causing this?
It is very likely that the main and background threads are accessing the same OpenGL ES context simultaneously.
OpenGL ES commands for a specific context are not reentrant. You should never have more than one thread accessing a single context at the same time. It is highly recommended that you use only one thread per context.
Listing 1 demonstrates how to create and make current a context contextB
using the sharegroup
property (an EAGLSharegroup
object) obtained from another already-allocated context contextA
. Such contexts that belong to the same sharegroup can share resources, for example, textures, FBOs, etc. So you may use contextB
on the secondary thread to create textures, and contextA
on the main thread to draw the textures onto screen.
Listing 1 Creating a context belonging to the same sharegroup
When you want to modify a resource on one context, you must first make sure it is not currently in use on another, even if you are accessing them from different threads. Once you modify it, its state is undefined until flushing and binding the object have been completed. You should never use an undefined object, whether you access it from a different context or not.
Take a texture as an example. Listing 2 shows the correct way to deal with multiple contexts. Any other ordering will not ensure consistent and correct behavior. It may result in data corruption, leaks, or crashes otherwise.
Listing 2 Modifying a texture on context B prior to using it on context A
For more information on the EAGLContext/-initWithAPI:sharegroup:
API and the sharegroup
property, see the EAGLContext Class Reference.