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

逛奔的蝸牛

我不聰明,但我會很努力

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

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>
            一区二区三区 在线观看视| 亚洲一区二区成人| 亚洲欧美一区二区激情| 亚洲激情另类| 久久免费视频这里只有精品| 亚洲欧美一区二区三区极速播放| 亚洲性视频h| 黄色欧美成人| 欧美肥婆在线| 另类天堂视频在线观看| 久久影视精品| 激情av一区| 欧美成人69| 黄色一区二区在线观看| 国产欧美日韩不卡免费| 久久精品成人一区二区三区蜜臀| 野花国产精品入口| 亚洲国产乱码最新视频| 国产免费成人av| 亚洲免费在线视频一区 二区| 欧美韩日视频| 欧美激情视频一区二区三区不卡| 亚洲黄页一区| 99re6热在线精品视频播放速度 | 亚洲国产日韩欧美在线图片| 久久久久免费| 亚洲日韩欧美视频一区| 亚洲精品老司机| 欧美性天天影院| 翔田千里一区二区| 欧美在线地址| 国产一区清纯| 久久久久久久波多野高潮日日 | 香蕉成人久久| 在线视频精品一| 欧美日韩综合视频| 在线一区日本视频| 日韩午夜中文字幕| 欧美精品在线网站| 99国产精品| 亚洲毛片在线免费观看| 欧美精品一区二区三区久久久竹菊| 亚洲高清123| 欧美成人午夜激情在线| 极品日韩av| 樱桃成人精品视频在线播放| 久久精品国产视频| 久久国产主播精品| 一色屋精品视频免费看| 免费欧美视频| 欧美激情欧美激情在线五月| 日韩视频精品| 午夜一区在线| 一区二区三区高清视频在线观看 | 国产精品毛片高清在线完整版| 久久免费国产| 欧美精品亚洲精品| 亚洲国产专区| 亚洲国产小视频在线观看| 欧美私人网站| 欧美va天堂| 国产精品视频一区二区高潮| 欧美成人一区二区三区在线观看 | 欧美日本三区| 老牛影视一区二区三区| 欧美性事免费在线观看| 亚洲国产岛国毛片在线| 含羞草久久爱69一区| 国产精品99久久久久久久女警| 亚洲黄色视屏| 午夜国产精品视频免费体验区| 久久先锋资源| 久久久久**毛片大全| 欧美性做爰毛片| 91久久精品国产91久久| 亚洲第一精品久久忘忧草社区| 亚洲欧美成人精品| 亚洲一区视频| 国产精品v日韩精品v欧美精品网站| 欧美凹凸一区二区三区视频| 国产综合av| 欧美一区二区三区在线看| 亚洲欧美中文日韩v在线观看| 欧美国产成人精品| 亚洲国产另类久久久精品极度| 亚洲成人自拍视频| 久久久久国色av免费看影院| 久久久久久欧美| 好吊日精品视频| 久久精品国产一区二区三区免费看| 羞羞视频在线观看欧美| 国产精品一二三四区| 亚洲综合久久久久| 欧美在线免费观看视频| 国产一区二区久久| 亚洲福利视频在线| 久久精品色图| 欧美成人国产一区二区| 久久久久久久久综合| 欧美一区二区三区另类| 久久久久国内| 亚洲激情网站免费观看| 嫩草影视亚洲| 夜夜爽av福利精品导航| 亚洲午夜精品一区二区三区他趣| 亚洲欧美在线免费观看| 一区二区国产日产| 午夜在线一区二区| 久久蜜桃精品| 宅男精品视频| 一区二区三区高清| 亚洲一区二区三区免费视频| 欧美午夜电影在线观看| 影音先锋久久资源网| 久久久国产精彩视频美女艺术照福利| 久久精品一区| 亚洲欧洲精品一区二区三区波多野1战4| 免播放器亚洲| 一区二区三区福利| 久久黄金**| 136国产福利精品导航| 欧美国产大片| 午夜精品视频在线观看| 久久野战av| 在线视频精品| 国产亚洲欧美日韩在线一区| 免费欧美视频| 亚洲无限乱码一二三四麻| 毛片av中文字幕一区二区| 夜夜精品视频一区二区| 国产乱子伦一区二区三区国色天香| 久久久久成人精品| 一区二区冒白浆视频| 另类尿喷潮videofree| 国产精品99久久久久久久女警| 国产女优一区| 欧美日韩国产一区精品一区| 久久精品视频导航| 一本不卡影院| 欧美福利专区| 欧美一区激情视频在线观看| 亚洲欧洲午夜| 国产一区二区欧美| 欧美午夜视频网站| 免费视频一区| 久久国产精品久久精品国产| 亚洲乱码久久| 亚洲大片免费看| 久久综合亚州| 久久福利电影| 亚洲一区在线免费观看| 最新国产拍偷乱拍精品 | 欧美成人精品在线视频| 亚洲在线网站| 亚洲美女精品久久| 欧美成熟视频| 玖玖玖国产精品| 欧美有码视频| 午夜欧美不卡精品aaaaa| 亚洲最新在线| 亚洲免费av电影| 亚洲国产婷婷综合在线精品 | 一本色道久久综合亚洲91| 欧美顶级大胆免费视频| 久久精品99国产精品酒店日本| 久久综合999| 欧美在线高清视频| 亚洲欧美日韩久久精品| 9久re热视频在线精品| 亚洲激情欧美| 亚洲日本一区二区| 最新日韩中文字幕| 欧美高清视频一区二区| 欧美不卡视频一区发布| 美女精品自拍一二三四| 亚洲高清一区二区三区| 国语自产精品视频在线看| 国产欧美综合在线| 国产麻豆综合| 国产一区二区三区久久久久久久久 | 久久男人av资源网站| 久久激情综合网| 久久全球大尺度高清视频| 久久久噜噜噜久久人人看| 久久精品道一区二区三区| 久久9热精品视频| 久久蜜桃精品| 欧美激情精品久久久久久蜜臀| 亚洲电影下载| 一个人看的www久久| 亚洲综合色激情五月| 久久精品91久久久久久再现| 久久久噜噜噜久久人人看| 蜜桃av综合| 欧美三级午夜理伦三级中视频| 欧美视频1区| 国产无一区二区| 亚洲国产成人在线播放| 99国产一区| 欧美一区二区视频97|