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

逛奔的蝸牛

我不聰明,但我會(huì)很努力

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

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://www.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>
            亚洲精品色图| 亚洲久色影视| 狂野欧美一区| 亚洲欧洲一区| 亚洲一区区二区| 国产日韩欧美在线观看| 久久久久久亚洲精品不卡4k岛国| 久久综合伊人77777| 亚洲精品三级| 国产精品热久久久久夜色精品三区| 亚洲综合视频网| 免费在线观看成人av| 一区二区三区高清不卡| 国产欧美日韩一区二区三区| 久久精品一区二区三区不卡牛牛 | 欧美激情第六页| 一本色道久久综合亚洲精品小说| 欧美一区二区三区久久精品| 激情五月综合色婷婷一区二区| 欧美 日韩 国产在线| 亚洲少妇最新在线视频| 免费欧美高清视频| 亚洲免费在线播放| 亚洲国产精品嫩草影院| 国产精品久久久一区二区| 久久久欧美精品sm网站| 一本综合精品| 欧美承认网站| 欧美影院一区| 一区二区三区国产精品| 伊大人香蕉综合8在线视| 欧美日韩调教| 免费欧美日韩国产三级电影| 亚洲在线不卡| 亚洲精选国产| 欧美顶级艳妇交换群宴| 久久久久久久国产| 亚洲免费一级电影| 99re6这里只有精品视频在线观看| 国产视频一区欧美| 国产精品伦理| 欧美日韩国产综合视频在线| 久久综合激情| 久久久久久久久岛国免费| 一区二区三区久久精品| 亚洲国产精品一区二区第一页| 久久精品人人做人人爽电影蜜月| 亚洲一区久久| 在线天堂一区av电影| 亚洲国产精品电影| 激情文学综合丁香| 国产一区二区三区黄视频| 国产精品视频成人| 国产精品捆绑调教| 欧美性猛交xxxx乱大交蜜桃| 欧美高清视频一区二区三区在线观看 | 欧美一区二区啪啪| 亚洲一区二区三区四区五区午夜 | 久久蜜桃精品| 久久精品一二三区| 久久不射中文字幕| 欧美在线电影| 久久国产精品99精品国产| 亚洲一区二区精品视频| 中文国产一区| 亚洲一区在线免费| 午夜精品视频在线观看| 亚洲欧美日韩另类| 午夜在线成人av| 久久都是精品| 久久性色av| 牛牛影视久久网| 欧美大片免费久久精品三p| 久久综合久久美利坚合众国| 久久免费视频这里只有精品| 久久久久久久成人| 久久久久久久97| 免费成人高清| 亚洲国产一区在线观看| 日韩视频在线观看免费| 亚洲国内精品在线| 日韩视频二区| 亚洲在线视频网站| 欧美一区永久视频免费观看| 欧美中在线观看| 美女国产一区| 欧美日韩在线精品一区二区三区| 欧美午夜精品久久久久久孕妇| 国产精品xvideos88| 国产日韩高清一区二区三区在线| 国产综合在线看| 亚洲欧洲综合| 午夜国产精品影院在线观看| 久久精品麻豆| 亚洲国产另类 国产精品国产免费| 亚洲日本久久| 亚洲欧美一区二区激情| 美女视频黄 久久| 欧美日韩一区在线视频| 国产综合在线视频| 日韩西西人体444www| 性欧美videos另类喷潮| 免费毛片一区二区三区久久久| 亚洲精品一区二区三区蜜桃久| 亚洲一区二区三区四区在线观看| 久久精品国产欧美亚洲人人爽| 欧美激情视频给我| 国产欧美一区二区三区沐欲| 亚洲国产精品t66y| 午夜精品www| 欧美激情一区二区三区不卡| 一区二区免费看| 久久视频一区二区| 国产精品v欧美精品v日韩精品| 一区二区视频免费完整版观看| 一区二区三区国产在线| 久久综合给合久久狠狠狠97色69| 99视频在线精品国自产拍免费观看 | 欧美伊人久久久久久午夜久久久久 | 一区二区亚洲精品国产| 中日韩男男gay无套| 美女999久久久精品视频| 一二三区精品福利视频| 久久一区二区三区av| 国产精品人人做人人爽| 亚洲欧洲日产国产综合网| 久久久久久久成人| 中日韩视频在线观看| 你懂的一区二区| 一区在线免费| 欧美在线观看视频一区二区三区| 91久久国产自产拍夜夜嗨| 欧美一区视频| 国产精品亚洲激情| 亚洲视频一区二区免费在线观看| 免费观看亚洲视频大全| 先锋a资源在线看亚洲| 欧美视频在线不卡| 日韩一级大片在线| 欧美电影免费观看高清完整版| 欧美亚洲一级| 国产日韩1区| 欧美一级成年大片在线观看| 夜夜爽夜夜爽精品视频| 欧美极品一区| 亚洲精品网址在线观看| 欧美国产视频日韩| 久久一区免费| 尤物在线观看一区| 老司机成人在线视频| 久久精品国产第一区二区三区| 国产精品一区久久久| 校园激情久久| 亚洲一区免费视频| 国产精品区一区二区三区| 亚洲欧美成aⅴ人在线观看| 99国产精品久久久久老师| 欧美日韩国产精品一卡| 99精品99| 一本久道久久久| 国产精品草莓在线免费观看| 一区二区三区黄色| 一区二区高清在线| 国产精品日本精品| 欧美一区二区三区在线观看| 亚洲欧美日韩国产另类专区| 国产精品一区二区三区四区| 欧美在线三区| 久久精品中文字幕免费mv| 精品白丝av| 欧美激情视频给我| 欧美日韩123| 亚洲欧美精品在线| 午夜伦欧美伦电影理论片| 黄色一区二区在线| 亚洲第一黄网| 欧美日韩精品三区| 性欧美精品高清| 久久精品人人做人人爽电影蜜月| 在线观看欧美激情| 亚洲国产综合在线看不卡| 欧美涩涩视频| 久久久美女艺术照精彩视频福利播放| 久久久亚洲欧洲日产国码αv| 亚洲黑丝在线| 亚洲私人影院| 在线播放中文字幕一区| 最新成人av在线| 国产伦精品一区二区| 欧美va亚洲va日韩∨a综合色| 欧美激情第9页| 午夜精品久久久| 久久九九全国免费精品观看| 亚洲欧洲综合| 亚洲欧美综合v| 亚洲青涩在线| 亚洲一区二区三区中文字幕| 有码中文亚洲精品| 亚洲午夜一二三区视频| 亚洲高清在线视频|