<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

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

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

          作者: 時(shí)間:2016-10-08 來源:網(wǎng)絡(luò) 收藏

          1.只有這2種數(shù)字鍵盤才有效果。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、設(shè)置時(shí)區(qū)

          NSTimeZone *defaultTimeZone = [NSTimeZone defaultTimeZone];

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

          [NSTimeZone setDefaultTimeZone:tzGMT];

          上面兩個(gè)時(shí)區(qū)任意用一個(gè)。

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

          [[NSNotificationCenter defaultCenter] addObserver:self

          selector:@selector(keyboardWillHide:)

          name:UIKeyboardWillHideNotification

          object:nil];

          - (IBAction)keyboardWillHide:(NSNotification *)note

          14、在一個(gè)程序中打開另一個(gè)程序的方法。

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

          15、計(jì)算字符串的字?jǐn)?shù)

          -(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 下一頁

          關(guān)鍵詞:

          評(píng)論


          相關(guān)推薦

          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();