你好,歡迎來到IOS教程網

 Ios教程網 >> IOS編程開發 >> IOS開發綜合 >> ios 匯總 - 數據 容器

ios 匯總 - 數據 容器

編輯:IOS開發綜合

dictionary

遍歷字典

NSLog(@"***遍歷字典myClassDict如下:");
for (id key in myClassDict)
{
NSLog(@"key: %@ ,value: %@",key,[myClassDict objectForKey:key]);
}


[_surveyAnswers1 setObject:myArrayAnswers1 forKey:@"FirstKey"];


for (NSString *key in [cacheDict allKeys]) {}

 

array

快速創建array

 

//NSMutableArray *array = [NSMutableArray arrayWithObjects: @"One",@"Two",@"Three",nil];

 

 


[_list addObjectsFromArray:[indexlist copy]];
_filteredList = [_stringList filteredArrayUsingPredicate:[NSPredicatepredicateWithFormat:@"SELF contains[cd] %@", searchString]];

 

 

/*-------------數組枚舉---------------*/
//- (NSEnumerator *)objectEnumerator;從前向後
//NSMutableArray *array = [NSMutableArray arrayWithObjects:
@"One",@"Two",@"Three",nil];
NSEnumerator *enumerator;
enumerator = [array objectEnumerator];

id thingie;
while (thingie = [enumerator nextObject]) {
NSLog(@"thingie:%@",thingie);
}

//- (NSEnumerator *)reverseObjectEnumerator;從後向前
//NSMutableArray *array = [NSMutableArray arrayWithObjects:
@"One",@"Two",@"Three",nil];
NSEnumerator *enumerator;
enumerator = [array reverseObjectEnumerator];

id object;
while (object = [enumerator nextObject]) {
NSLog(@"object:%@",object);
}

NSString

rang.location 指向的是 @"//" 的頭一個字符
NSRange range;
range = [url rangeOfString:@"//"];
if (range.length > 0) {
url = [url substringFromIndex:range.location + range.length];
}
從 // 之後截取 range = [url rangeOfString:@"/"];
if (range.length > 0) {
url = [url substringFromIndex:range.location + 1];
}
截取到 # ,不包含#
range = [url rangeOfString:@"#"];
if (range.length > 0 && range.location > 0) {
url = [url substringToIndex:range.location];
}


modulename = [NSStringstringWithUTF8String:(*itStr).c_str()];
NSString* welcomeInfo =[@"歡迎回來 "stringByAppendingString:nickName]; NSString *servantCmd = [NSString stringWithFormat:@"wnsxms.%@",@"getcommandlist"];

 

 

  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved