熟女俱乐部五十路二区av,又爽又黄禁片视频1000免费,国产卡一卡二卡三无线乱码新区,中文无码一区二区不卡αv,中文在线中文a

新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > iphone開發(fā)中的一些小技巧

iphone開發(fā)中的一些小技巧

作者: 時間:2016-10-08 來源:網絡 收藏

1.只有這2種數字鍵盤才有效果。UIKeyboardTypeNumberPad,UIKeyboardTypePhonePad

2. keyboardAppearance = UIKeyboardAppearanceAlert

- (void)textViewDidBeginEditing:(UITextView *)textView{

NSArray *ws = [[UIApplication sharedApplication] windows];

for(UIView *w in ws){

NSArray *vs = [w subviews];

for(UIView *v in vs)

{

if([[NSString stringWithUTF8String:object_getClassName(v)] isEqualToString:@UIKeyboard])

{

v.backgroundColor = [UIColor redColor];

}

}

}

13、設置時區(qū)

NSTimeZone *defaultTimeZone = [NSTimeZone defaultTimeZone];

NSTimeZone *tzGMT = [NSTimeZone timeZoneWithName:@GMT];

[NSTimeZone setDefaultTimeZone:tzGMT];

上面兩個時區(qū)任意用一個。

14、Ipad隱藏鍵盤的同時觸發(fā)方法。

[[NSNotificationCenter defaultCenter] addObserver:self

selector:@selector(keyboardWillHide:)

name:UIKeyboardWillHideNotification

object:nil];

- (IBAction)keyboardWillHide:(NSNotification *)note

14、在一個程序中打開另一個程序的方法。

http://www.cocoachina.com/iphonedev/sdk/2010/0322/768.html

15、計算字符串的字數

-(int)calculateTextNumber:(NSString *)text

{

float number = 0.0;

int index = 0;

for (index; index [text length]; index++)

{

NSString *protoText = [text substringToIndex:[text length] - index];

NSString *toChangetext = [text substringToIndex:[text length] -1 -index];

NSString *charater;

if ([toChangetext length]==0)

{

charater = protoText;

}

else

{

NSRange range = [text rangeOfString:toChangetext];

charater = [protoText stringByReplacingCharactersInRange:range withString:@];

}

NSLog(charater);

if ([charater lengthOfBytesUsingEncoding:NSUTF8StringEncoding] == 3)

{

number++;

}

else

{

number = number+0.5;

}

}

return ceil(number);

}


上一頁 1 2 下一頁

關鍵詞:

評論


相關推薦

技術專區(qū)

關閉