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

逛奔的蝸牛

我不聰明,但我會很努力

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

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>
            国产综合av| 欧美激情bt| 国产色综合久久| 欧美日韩亚洲一区三区 | 欧美精品尤物在线| 免费h精品视频在线播放| 久久久99精品免费观看不卡| 欧美一区二区三区四区夜夜大片| 午夜视频久久久久久| 欧美亚洲一区二区三区| 欧美一级成年大片在线观看| 久久成人av少妇免费| 久久人人精品| 欧美伦理视频网站| 国产精品色网| 激情欧美丁香| 99re这里只有精品6| 亚洲一区视频在线观看视频| 午夜日韩在线| 美女诱惑黄网站一区| 亚洲精品免费观看| 亚洲国产精品va在线看黑人动漫| 亚洲国产欧洲综合997久久| 一级日韩一区在线观看| 亚洲欧美视频一区| 嫩草国产精品入口| 国产精品伦子伦免费视频| 亚洲日本一区二区三区| 亚洲主播在线播放| 免费久久久一本精品久久区| 欧美视频四区| 亚洲国产精品小视频| 午夜精品久久久久影视 | 一区二区三欧美| 久久精品道一区二区三区| 欧美另类69精品久久久久9999| 国产精品亚洲综合一区在线观看| 激情综合中文娱乐网| 亚洲欧美激情精品一区二区| 欧美国产日本韩| 欧美在线看片| 国产精品一区免费观看| 日韩一二三在线视频播| 久久一区二区三区四区| 一区二区三区波多野结衣在线观看| 久久日韩精品| 国产情侣久久| 亚洲欧美激情在线视频| 亚洲黄色片网站| 久久米奇亚洲| 韩国视频理论视频久久| 午夜精品福利一区二区蜜股av| 亚洲激情在线激情| 久久一综合视频| 精品福利av| 久久网站热最新地址| 国产精品99久久久久久宅男| 欧美—级a级欧美特级ar全黄| 一区在线视频| 久久人人精品| 久久久久久**毛片大全| 国产一区二区在线免费观看 | 亚洲成人直播| 久久久噜噜噜久久人人看| 国产香蕉久久精品综合网| 亚洲欧美在线网| 一二三四社区欧美黄| 欧美日韩综合在线| 亚洲一区二区三区成人在线视频精品| 亚洲黄色影片| 国产精品va在线播放| 宅男噜噜噜66国产日韩在线观看| 亚洲国产综合视频在线观看| 欧美丰满高潮xxxx喷水动漫| 亚洲伦伦在线| 99国产麻豆精品| 国产精品日韩欧美一区二区三区| 性视频1819p久久| 欧美一区日韩一区| 一区二区三区在线观看欧美 | 免费成人高清| 亚洲国产成人91精品| 久久综合九色综合欧美狠狠| 有码中文亚洲精品| 欧美黄色免费| 欧美日韩综合另类| 久久爱91午夜羞羞| 久久精品中文| 一本久道久久久| 亚洲小视频在线观看| 国产一级久久| 亚洲精品1区| 国产日韩欧美在线观看| 久久在线视频在线| 欧美激情无毛| 欧美在线综合视频| 久久最新视频| 亚洲欧美日韩一区二区三区在线观看 | 亚洲综合三区| 久久亚洲春色中文字幕久久久| 亚洲国产欧美不卡在线观看| 亚洲久久在线| 影院欧美亚洲| 亚洲淫片在线视频| 亚洲国产精品久久久久秋霞蜜臀| 最近看过的日韩成人| 国产真实乱偷精品视频免| 亚洲精品乱码久久久久久黑人| 国产欧美一区二区色老头| 亚洲国语精品自产拍在线观看| 国产欧美在线观看一区| 亚洲美女精品一区| 一区精品久久| 夜夜嗨av一区二区三区免费区| 在线日韩欧美视频| 亚洲综合色在线| 亚洲视频在线看| 欧美搞黄网站| 欧美成人精品影院| 国产亚洲午夜高清国产拍精品| 亚洲精品在线三区| 亚洲片区在线| 久久亚洲欧洲| 久久久久国产精品www| 欧美视频精品一区| 亚洲欧洲在线一区| 亚洲精品四区| 欧美成人综合在线| 欧美成人蜜桃| 在线看不卡av| 久久手机精品视频| 久久一本综合频道| 影视先锋久久| 久久久久国产精品麻豆ai换脸| 欧美一区二区三区免费视| 欧美视频一区| 一区二区三区高清不卡| 宅男精品视频| 欧美视频在线不卡| 中文亚洲字幕| 亚欧美中日韩视频| 国产日韩欧美精品在线| 亚洲一区在线观看免费观看电影高清| 亚洲天堂男人| 亚洲欧美国产高清va在线播| 亚洲一区在线免费| 欧美性猛片xxxx免费看久爱| 99av国产精品欲麻豆| 亚洲美女啪啪| 欧美午夜激情视频| 亚洲一区二区三区乱码aⅴ蜜桃女| 亚洲欧美一区二区三区久久| 国产精品乱看| 久久精品久久综合| 美日韩精品免费| 亚洲激情在线观看| 欧美日韩久久不卡| 亚洲一区二区三区欧美| 久久成人一区| 亚洲国产成人久久综合| 欧美另类视频在线| 亚洲先锋成人| 麻豆国产精品一区二区三区 | 亚洲一区二区精品| 国产精品女人毛片| 久久国产精品一区二区| 久久人人爽人人爽| 日韩亚洲成人av在线| 欧美日韩免费区域视频在线观看| 一区二区三区欧美激情| 欧美专区一区二区三区| 亚洲国产成人91精品| 欧美日韩一级大片网址| 午夜日韩在线| 亚洲欧洲另类国产综合| 欧美一区二区大片| 亚洲人成免费| 国产精品伊人日日| 免费精品视频| 欧美在线精品一区| 在线亚洲电影| 亚洲国产精品悠悠久久琪琪| 香蕉久久一区二区不卡无毒影院| 精品999在线观看| 欧美日韩一区自拍| 久久精品123| 亚洲视频axxx| 亚洲黄色大片| 久久久久女教师免费一区| 一区二区三区黄色| 亚洲第一搞黄网站| 国产一区二区三区在线观看网站 | 国产一区观看| 国产精品swag| 欧美精品在线一区二区三区| 欧美一站二站| 亚洲无线观看| 洋洋av久久久久久久一区| 欧美高清在线播放| 久久一日本道色综合久久|