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

逛奔的蝸牛

我不聰明,但我會很努力

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

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>
            欧美四级伦理在线| 亚洲国产综合视频在线观看| 一区二区视频在线观看| 国产精品免费看片| 国产欧美日韩综合一区在线观看 | 久久国产精品黑丝| 久久精品亚洲国产奇米99| 久久视频在线免费观看| 欧美成年人视频网站| 欧美日韩国产一级片| 国产精品性做久久久久久| 国内成+人亚洲| 99视频热这里只有精品免费| 亚洲直播在线一区| 美女主播一区| 99视频有精品| 久久久久久精| 欧美调教vk| 在线高清一区| 亚洲一区二区黄色| 蜜乳av另类精品一区二区| 99re热精品| 久久久久久夜精品精品免费| 欧美精品一区二区视频| 国产一区二区三区免费不卡| 亚洲精品国精品久久99热| 欧美一区不卡| 国产夜色精品一区二区av| 美日韩精品视频免费看| 国产精品成人一区二区三区夜夜夜 | 欧美影院成年免费版| 欧美激情第一页xxx| 国产日韩欧美成人| 中文av字幕一区| 久热re这里精品视频在线6| 这里只有视频精品| 欧美女同在线视频| 亚洲国产精品尤物yw在线观看| 欧美一区二区观看视频| 亚洲精品视频在线播放| 蜜桃av一区| 在线精品国产成人综合| 欧美在线视频免费观看| 99一区二区| 欧美韩日一区二区| 亚洲国产成人av在线| 久久久噜噜噜久久| 小黄鸭精品aⅴ导航网站入口| 欧美日韩另类丝袜其他| 亚洲激精日韩激精欧美精品| 久久天天综合| 久久成人这里只有精品| 国产日韩欧美一区二区| 欧美一区视频在线| 性8sex亚洲区入口| 国际精品欧美精品| 久久久精品999| 午夜精品一区二区三区在线| 国产精品入口夜色视频大尺度 | 亚洲一二三级电影| 国产精品成av人在线视午夜片| 亚洲精品国产拍免费91在线| 欧美成人四级电影| 欧美 日韩 国产一区二区在线视频 | 免费成人毛片| 亚洲国产裸拍裸体视频在线观看乱了| 久久亚洲一区二区三区四区| 欧美在线看片| 在线欧美一区| 亚洲激情一区二区三区| 欧美日韩大片| 亚洲欧美视频在线观看视频| 亚洲欧美日韩国产一区二区三区| 国产精品乱人伦一区二区| 校园春色国产精品| 欧美专区在线观看一区| 牛夜精品久久久久久久99黑人 | 男女激情久久| 欧美成人中文字幕在线| 一区二区欧美在线观看| 亚洲视频第一页| 国产亚洲精品aa午夜观看| 理论片一区二区在线| 欧美丰满少妇xxxbbb| 亚洲一区在线观看免费观看电影高清 | 亚洲福利视频专区| 亚洲美女91| 国产亚洲网站| 亚洲青涩在线| 国产欧美一区二区视频| 欧美成人激情在线| 欧美日韩亚洲一区在线观看| 久久精品国产亚洲精品| 欧美不卡一卡二卡免费版| 亚洲制服av| 免费不卡在线观看av| 午夜综合激情| 欧美精品九九99久久| 欧美在线一二三四区| 欧美激情免费观看| 久久九九精品99国产精品| 欧美屁股在线| 美女精品网站| 国产伦精品免费视频| 亚洲激情六月丁香| 伊人久久大香线蕉综合热线| 中文在线不卡视频| 91久久嫩草影院一区二区| 亚洲欧美bt| 一区二区三区精品国产| 久久久欧美一区二区| 亚洲自拍另类| 欧美日韩的一区二区| 能在线观看的日韩av| 国产欧美在线观看一区| 一本色道久久综合亚洲精品不卡| 91久久精品视频| 久久在线视频| 久久午夜精品一区二区| 欧美视频在线播放| 亚洲精品麻豆| 99国产精品久久久久久久久久| 久久久亚洲欧洲日产国码αv | 亚洲无玛一区| 在线亚洲精品| 欧美成人精品1314www| 久久深夜福利免费观看| 国产日韩精品在线观看| 亚洲天堂男人| 亚洲在线1234| 欧美视频在线免费| 一本久久综合亚洲鲁鲁五月天| 亚洲精品视频一区二区三区| 狼人天天伊人久久| 亚洲高清视频一区二区| 久久人人爽人人爽| 国产欧美一区二区精品性 | 麻豆久久精品| 免费观看成人www动漫视频| 国产日韩精品一区二区| 亚洲免费人成在线视频观看| 欧美亚洲色图校园春色| 国产欧美日韩精品专区| 亚洲欧美日韩一区二区在线| 欧美一站二站| 国产亚洲精品高潮| 久久国内精品视频| 免费欧美电影| 亚洲人精品午夜| 欧美巨乳在线观看| 99国产精品久久久久老师| 亚洲宅男天堂在线观看无病毒| 国产精品亚发布| 久久精品亚洲| 亚洲高清久久网| 亚洲午夜久久久久久久久电影网| 国产精品久久久免费| 香蕉乱码成人久久天堂爱免费| 久久亚洲一区二区| 日韩视频专区| 国产精品午夜电影| 毛片基地黄久久久久久天堂| 99国内精品久久| 久久久国产精品亚洲一区| 亚洲第一区在线观看| 国产精品国色综合久久| 久久久久久久久久码影片| 亚洲电影免费观看高清完整版在线 | 亚洲激情中文1区| 亚洲欧美日韩国产一区二区三区| 国产啪精品视频| 美女视频网站黄色亚洲| 一区二区国产日产| 乱中年女人伦av一区二区| 中日韩在线视频| 国内自拍亚洲| 欧美三区不卡| 麻豆freexxxx性91精品| 亚洲淫性视频| 亚洲国产日韩一区| 可以看av的网站久久看| 亚洲欧美日韩系列| 亚洲日本成人| 国模私拍一区二区三区| 国产精品大全| 欧美激情女人20p| 久久免费国产| 亚洲一区在线观看视频| 亚洲国产毛片完整版| 久久五月激情| 欧美一区二区三区在线观看视频| 最新成人av网站| 伊人精品视频| 国产专区精品视频| 国产精品一区二区久久国产| 欧美激情综合在线| 麻豆精品91| 久久综合99re88久久爱| 香蕉久久a毛片| 午夜精品久久久99热福利|