總結

 風火輪:

    UIActivityIndicatorView *refreshMum = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
    refreshMum.frame = CGRectMake(100, 20, 40, 40);
    [refreshMum startAnimating];//開始轉動
    refreshMum.hidden =yes; //隱藏
 
 
文本控件改變鍵盤大寫鍵:
 _multiDomainTextView.autocapitalizationType =UITextAutocapitalizationTypeNone;
 
 
 
 
cell 加控件:
//在繪製單元格時
cell.accessoryView = button ;
 
 
提示控件:
   UIAlertView *alert = [[UIAlertView alloc]initWithTitle:[NSString stringWithFormat:@"您輸入的域名“%@”不正確",_multiDomainTextView.text] message:@"您選擇了英文查詢狀態,請輸入英文域名!\n例如:taobao" delegate:nil cancelButtonTitle:@"確定"  otherButtonTitles:nil];   
            [alert show]; 
 
 
 
 
字符串拆分
NSString * textViewText=@"aaaaaaa \n aaaa aaaa \n ";
    textViewText = [textViewText stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];  //去掉空格和換行
    //根據換行符將字符串拆分成數組
    NSMutableArray * textArrayNumberOne = [[NSMutableArray alloc]init];
    [textArrayNumberOne setArray:[textViewText componentsSeparatedByString:@"\n"]];
    NSLog(@"%@",textArrayNumberOne);
            [alert release];
          [textArrayNumberOne release];
 
 
 
 
把該數組中爲空的元素去掉:
 
 for (int i = 0; i < textArrayNumberOne.count; i++)
                    if ([[textArrayNumberOne objectAtIndex:i] isEqualToString:@""]) {
                        [textArrayNumberOne removeObjectAtIndex:i];
                    }
                }
 
 
 
 
 
將字符串拼接:
                        [suffixedArray addObject:[NSString stringWithFormat:@"%@%@",[textArrayNumberOne objectAtIndex:i],[suffixArray objectAtIndex:j]]];
 
          //將拼接好的字符串用,隔開
                NSMutableString *  str= [[[NSMutableString alloc] init] autorelease];
                for (int i = 0; i<suffixedArray.count; i++)
                {
                    if (i>0) {
                        [str appendString:@","];
                    }        
                    [str appendString:[suffixedArray objectAtIndex:i]];
                    
                }
                NSLog(@"%@",str);
 
 
 
判斷字符串中是否包含中文:
 
將字符串中的字符取到一個一個字符循環判斷
     int length = [_multiDomainTextView.text length];
        for (int i=0; i<length; ++i)
        {
            NSRange range = NSMakeRange(i, 1);
            NSString *subString = [_multiDomainTextView.text substringWithRange:range];
            const char *cString = [subString UTF8String];
            if (strlen(cString) == 3)
            {
                _language=YES;
                break;
            }
        }
        
 
 
 
 
 
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章