青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

逛奔的蝸牛

我不聰明,但我會很努力

   ::  :: 新隨筆 ::  ::  :: 管理 ::

1. Open URL in Safari

    NSURL *url = [ [ NSURLalloc ] initWithString@" ];

    [[UIApplication sharedApplication] openURL:url];


2. Date Formatting on iPhone and Cocoa

    //Format Date

    NSDateFormatter *dateFormat = [[NSDateFormatterallocinit];

    [dateFormat setDateFormat@"yyyy-MM-dd HH:mm:ss zzz"]; // 2009-02-01 19:50:41 PST

    NSString *dateString = [dateFormat stringFromDate: [scoreDataobjectForKey@"date"]];

3. Get iPhone Application Version Number

    NSString*version = [[[NSBundlemainBundleinfoDictionaryobjectForKey:@"CFBundleVersion"];

4. Duplicate Xcode project

    1. Copy/rename the folder into new name

    2. Get inside the new folder and rename the .pch and .xcodeproj files

    3. Delete the build folder

    4. Open .xcodeproj file in text editor, like TextMate or TextWrangler. That’s actually a folder, which contains 4 files (you can also right-click and do Show package contents, which will reveal the files)

    5. Open project.pbxproj in text editor and replace all instances of the old name with the new name

    6. Load the project file in XCode, do Build/Clean all targets

5. iPhone HTTP request

     //prepar request

     NSString *urlString = [NSStringstringWithFormat:@"];

     NSMutableURLRequest *request = [[[NSMutableURLRequestallocinitautorelease];

     [request setURL:[NSURLURLWithString:urlString]];

     [request setHTTPMethod:@"POST"];

     //set headers

     NSString *contentType = [NSStringstringWithFormat:@"text/xml"];

     [request addValue:contentType forHTTPHeaderField: @"Content-Type"];

    

     //create the body

     NSMutableData *postBody = [NSMutableDatadata];

     [postBody appendData:[[NSStringstringWithFormat:@"<xml>"dataUsingEncoding:NSUTF8StringEncoding]];

     [postBody appendData:[[NSStringstringWithFormat:@"<yourcode/>"dataUsingEncoding:NSUTF8StringEncoding]];

     [postBody appendData:[[NSStringstringWithFormat:@"</xml>"dataUsingEncoding:NSUTF8StringEncoding]];

     //post

     [request setHTTPBody:postBody];

     //get response

     NSHTTPURLResponse* urlResponse = nil;  

     NSError *error = [[NSErroralloc] init];  

     NSData *responseData = [NSURLConnectionsendSynchronousRequest:request returningResponse:&urlResponse error:&error];  

     NSString *result = [[NSStringallocinitWithData:responseData encoding:NSUTF8StringEncoding];

     NSLog(@"Response Code: %d", [urlResponse statusCode]);

     if ([urlResponse statusCode] >= 200 && [urlResponse statusCode] < 300) {

          NSLog(@"Response: %@", result);

        

          //here you get the response  

     }

6. Load Image from URL and then Resize

    NSString* imageURL = [NSString stringWithFormat: @"http://theimageurl.com/?id=%@", [[resultsEntries objectAtIndex:0] objectForKey: @"image_large"]];

    NSData* imageData = [[NSDataalloc]initWithContentsOfURL:[NSURLURLWithString:imageURL]];

    UIImage* image = [[UIImageallocinitWithData:imageData];

    

    // resize image

    CGSize newSize = CGSizeMake(100100);

    UIGraphicsBeginImageContext( newSize );// a CGSize that has the size you want

    [image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];

    

    //image is the original UIImage

    UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    

    imageHeight = image.size.height;

    [imageMain setImage:newImage];

    [imageData release];

    [image release];

7. iPhone: transition between views

    // get the view that's currently showing

    UIView *currentView = self.view;

    // get the the underlying UIWindow, or the view containing the current view view

    UIView *theWindow = [currentView superview];

    

    // remove the current view and replace with myView1

    [currentView removeFromSuperview];

    [theWindow addSubview:view1];

    

    // set up an animation for the transition between the views

    CATransition *animation = [CATransition animation];

    [animation setDuration:0.5];

    [animation setType:kCATransitionPush];

    [animation setSubtype:kCATransitionFromRight];

    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];

    

    [[theWindow layer] addAnimation:animation forKey:@"SwitchToView1"];

8. get iPhone ip address

#include <ifaddrs.h>

#include <arpa/inet.h>

- (NSString*)getIPAddress {

    NSString *address = @"error";

    structifaddrs *interfaces = NULL;

    structifaddrs *temp_addr = NULL;

    int success = 0;

    // retrieve the current interfaces - returns 0 on success

    success = getifaddrs(&interfaces);

    if (success == 0) {

        // Loop through linked list of interfaces

        temp_addr = interfaces;

        while(temp_addr != NULL) {

            if(temp_addr->ifa_addr->sa_family == AF_INET) {

                // Check if interface is en0 which is the wifi connection on the iPhone

                // Mac 里用en0

                if([[NSString stringWithUTF8String:temp_addr->ifa_name] isEqualToString:@"en1"]) {

                    // Get NSString from C String

                    address = [NSString stringWithUTF8String:inet_ntoa(((struct sockaddr_in *)temp_addr->ifa_addr)->sin_addr)];

                }

            }

            temp_addr = temp_addr->ifa_next;

        }

    }

    // Free memory

    freeifaddrs(interfaces);

    

    return address;

}

9. Useful Cocoa Macros

#define APP_NAME [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"]

#define APP_VERSION [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]

#define OPEN_URL(urlString) [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:urlString]]


// Retrieving preference values

#define PREF_KEY_VALUE(x) [[[NSUserDefaultsController sharedUserDefaultsController] values] valueForKey:(x)]

#define PREF_KEY_BOOL(x) [(PREF_KEY_VALUE(x)) boolValue]

#define PREF_SET_KEY_VALUE(x, y) [[[NSUserDefaultsController sharedUserDefaultsController] values] setValue:(y) forKey:(x)]

#define PREF_OBSERVE_VALUE(x, y) [[NSUserDefaultsController sharedUserDefaultsController] addObserver:y forKeyPath:x options:NSKeyValueObservingOptionOld context:nil];


/* key, observer, object */

#define OB_OBSERVE_VALUE(x, y, z) [(z) addObserver:y forKeyPath:x options:NSKeyValueObservingOptionOld context:nil];


#ifdef __OBJC__

staticinlineBOOL isEmpty(id thing) {

    return thing == nil

|| ([thing respondsToSelector:@selector(length)]

        && [(NSData *)thing length] == 0)

|| ([thing respondsToSelector:@selector(count)]

        && [(NSArray *)thing count] == 0);

}

#endif

10. iPhone OS - Vibration - Simple Version

Creating a vibration is simple as pie - simpler in fact. It just requires one line of code; two if you add the import line. But as simple as a one-liner is it is better to make it into a function. So here is the one liner, followed by the function.

//  NOTE: You need to import the AudioToolbox for access to the vibrate

#import <AudioToolbox/AudioToolbox.h>


//  The one-liner:

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);


//  The function:

- (void)vibrate {

    AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

}


//  The call from within another method in the same class:

- (void)myMethod {

    [self vibrate];

}

@import url(http://m.shnenglu.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            一本不卡影院| 欧美精品久久久久久久久久| 久久青草福利网站| 欧美一区二区三区四区夜夜大片| 日韩午夜三级在线| 亚洲国产综合91精品麻豆| 在线欧美三区| 日韩一区二区电影网| 狠狠色狠狠色综合日日tαg| 亚洲韩国日本中文字幕| 欧美伊人久久大香线蕉综合69| 久久久青草青青国产亚洲免观| 亚洲欧美电影院| 欧美精品一线| 樱桃国产成人精品视频| 99精品国产热久久91蜜凸| 欧美在线亚洲一区| 亚洲免费av电影| 浪潮色综合久久天堂| 国产视频一区欧美| 99精品视频一区二区三区| 久久久噜噜噜久噜久久 | 欧美视频一区二区三区四区| 国产精品v片在线观看不卡| 曰韩精品一区二区| 久久国产精品99精品国产| 亚洲免费观看高清完整版在线观看熊| 久久国产精品一区二区三区四区 | 亚洲影院高清在线| 欧美国产日韩一区二区| 1024国产精品| 欧美激情性爽国产精品17p| 在线亚洲欧美| 亚洲第一网站免费视频| 久久久久久久激情视频| 91久久久在线| 999亚洲国产精| 久久精品视频网| 久久综合久久88| 99精品视频一区| 欧美一区不卡| 日韩视频免费观看高清在线视频| 国产精品家庭影院| 久久亚洲一区二区| 欧美日韩在线高清| 久久久欧美精品| 亚洲人成绝费网站色www| 亚洲免费一区二区| 激情综合久久| 亚洲人体大胆视频| 国产一区在线看| 亚洲美女视频网| 亚洲一品av免费观看| 国产伦精品一区二区三区照片91| 亚洲国产精品一区二区久| 欧美伦理视频网站| 久久综合成人精品亚洲另类欧美| 欧美精品一区二区三区四区| 香蕉久久夜色精品国产使用方法 | 永久555www成人免费| 在线综合亚洲欧美在线视频| 亚洲黄色性网站| 美女黄毛**国产精品啪啪| 免费观看成人www动漫视频| 久久综合给合| 久久av一区二区三区| 在线视频欧美日韩精品| 久久久久久免费| 久久久国产亚洲精品| 久久人人97超碰精品888| 欧美国产日韩xxxxx| 欧美+亚洲+精品+三区| 国产美女精品视频| 亚洲欧美日韩国产中文| 亚洲欧美一区在线| 国模精品一区二区三区| 欧美一级片久久久久久久| 先锋资源久久| 国产一区二区三区黄| 久久精品伊人| 欧美黑人一区二区三区| 1769国产精品| 欧美精品日本| 韩国av一区二区三区在线观看| 亚洲欧美日韩国产综合精品二区| 亚洲欧美日韩精品一区二区| 国产乱子伦一区二区三区国色天香 | 欧美a级片网站| 99re亚洲国产精品| 久久久久久久性| 国产精品99久久久久久有的能看| 国产精品欧美一区二区三区奶水| 久久久精品2019中文字幕神马| 欧美老女人xx| 亚洲女ⅴideoshd黑人| 麻豆成人在线| 亚洲欧美国产一区二区三区| 激情欧美日韩一区| 国产精品一区二区久久| 欧美福利电影网| 久久综合导航| 久久久久高清| 午夜精品国产| 午夜在线电影亚洲一区| 亚洲啪啪91| 亚洲国产日韩欧美一区二区三区| 久久在线视频| 久久天天综合| 久久久久久久精| 久久全球大尺度高清视频| 亚洲五月六月| 欧美一区亚洲二区| 一本一本大道香蕉久在线精品| 99成人在线| 亚洲色在线视频| 欧美亚洲网站| 久久精品国产99精品国产亚洲性色 | 亚洲午夜性刺激影院| 一区二区三区高清不卡| 一区二区三区四区在线| 亚洲电影第1页| 亚洲三级影片| 欧美日韩视频在线| 欧美日韩在线不卡| 久久在线免费| 欧美黄色大片网站| 久久婷婷麻豆| 久久综合色婷婷| 亚洲狼人精品一区二区三区| 亚洲午夜国产一区99re久久| 欧美亚洲一区二区在线观看| 久久精品国产91精品亚洲| 久久九九热re6这里有精品| 玖玖视频精品| 亚洲看片一区| 一区二区三区四区五区视频| 一区二区三区福利| 欧美一区网站| 欧美激情黄色片| 亚洲在线中文字幕| 免费一级欧美在线大片| 欧美视频官网| 洋洋av久久久久久久一区| 久久国产乱子精品免费女| 亚洲狼人综合| 免费久久99精品国产自| 欧美区亚洲区| 国产精品视频免费观看www| 激情欧美国产欧美| 能在线观看的日韩av| 欧美国产一区在线| 国产日韩欧美综合在线| 欧美成黄导航| 国产亚洲午夜高清国产拍精品| 亚洲日本中文字幕区| 欧美国产1区2区| 久久性色av| 亚洲大胆女人| 亚洲电影观看| 欧美日韩一区二区欧美激情| 亚洲视频欧洲视频| 亚洲欧美一区二区精品久久久| 亚洲精品无人区| 国产精品久久91| 乱码第一页成人| 欧美日韩国产二区| 欧美一区中文字幕| 午夜精品一区二区三区在线视| 亚洲视频在线观看视频| 国产亚洲精品久久久久久| 免费观看在线综合| 欧美网站在线观看| 欧美成人资源网| 国产伦精品一区二区| 最新中文字幕一区二区三区| 国产精品青草久久久久福利99| 久久一区二区三区国产精品| 欧美色中文字幕| 亚洲精品偷拍| 亚洲精品网站在线播放gif| 久久精品成人欧美大片古装| 亚洲一区二区av电影| 欧美日韩大陆在线| 亚洲大片免费看| 亚洲国产成人av| 亚洲成人在线| 蜜桃av久久久亚洲精品| 久久久久久9| 国产精品久久久亚洲一区| 亚洲人成77777在线观看网| 一区二区三区我不卡| 久久久久综合一区二区三区| 久久九九精品| 亚洲高清不卡一区| 久久理论片午夜琪琪电影网| 久久久久国色av免费看影院| 狠狠色丁香婷婷综合影院| 欧美尤物一区| 欧美大片免费看| 艳女tv在线观看国产一区|