Tuesday, March 26, 2013

Бриф разработчика мобильных приложений

Cache URL images iphone UITableview

Возможности отладчика в Xcode 4.5 Debug

UITextView multiline

Хочешь быть iOS разработчиком? Будь им! Подборка

Objective C Data Caching on iOS

Saturday, March 23, 2013

Add UITextField Programmatically


CGRect textFieldFrame = CGRectMake(0.00.0100.030.0);
UITextField *txtField = [[UITextField allocinitWithFrame:textFieldFrame];
// default is UITextBorderStyleNone. If set to UITextBorderStyleRoundedRect, custom background images are ignored.

[txtField setBorderStyle:UITextBorderStyleRoundedRect];
[txtField setTextColor:[UIColor blackColor]];
[txtField setFont:[UIFont systemFontOfSize:20]];
[txtField setDelegate:self];
[txtField setPlaceholder:@"Add Your Placeholder Text Here"];
[txtField setBackgroundColor:[UIColor whiteColor]];
txtField.keyboardType = UIKeyboardTypeDefault;


http://ios.biomsoft.com/tag/uitextfield/

Thursday, March 21, 2013

header http


NSMutableURLRequest* request = [[[NSMutableURLRequest alloc] initWithURL:url]
                                autorelease];

[request setValue:VALUE forHTTPHeaderField:@"Field You Want To Set"];
or to add a header:
[request addValue:VALUE forHTTPHeaderField:@"Field You Want To Set"];
Accept: application/json, 

Wednesday, March 20, 2013

UINavigation Label


CGRect frame = CGRectMake(0, 0, 400, 44);
UILabel *label = [[[UILabel alloc] initWithFrame:frame] autorelease];
label.backgroundColor = [UIColor clearColor];
label.font = [UIFont [UIFont fontWithName:@"123Sans-Bold" size:12]];
label.textAlignment = UITextAlignmentCenter;
label.textColor = [UIColor whiteColor];
label.text = @"Sample custom Title With small Fonts ";
self.navigationItem.titleView = label;


label.font = [UIFont boldSystemFontOfSize:8.0];

Жизненный цикл UIViewController'a

Sunday, March 17, 2013

frame and bounds


В: В чем разница между frame и bounds?   
О: frame – это прямоугольник описываемый положением location(x, y) и размерами size (width, height) вьюхи относительно ее superview в которой оа содержится. bounds – это прямоугольник описываемый положением location(x, y) и размерами size (width, height) вьюхи относительно ее собственной систмы координат (0, 0).


http://it-interview.ru/voprosy-i-otvety-na-sobesedovanii-dlya-ios-razrabotchika/

Про вопросы на интервью

Friday, March 15, 2013

Plugins for Chrome

JSONView 0.0.32
Advanced REST client 3.1.1 
Trello Exporter 0.1 


Wednesday, March 13, 2013

Share image from bundle and link on Facebook in iphone


NSString *filePath = [[NSBundle mainBundle] pathForResource:@"image1" ofType:@"png"];
NSData *videoData = [NSData dataWithContentsOfFile:filePath];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   @"My hat image", @"message", data, @"source", nil];

[facebook requestWithGraphPath:@"/me/photos" andParams:params andHttpMethod:@"POST" andDelegate:self];

http://stackoverflow.com/questions/14748140/share-image-from-bundle-and-link-on-facebook-in-iphone

http://developers.facebook.com/docs/reference/dialogs/feed/

https://github.com/bdelliott/wordgame/tree/master/Facebook%20IOS%20SDK

Tuesday, March 12, 2013

UIKit Classes

without ARC

http://stackoverflow.com/questions/2189919/how-is-release-handled-for-synthesized-retain-properties

check version iOS



You can get the OS version using:
[[UIDevice currentDevice] systemVersion]
However, you should avoid relying on the version string as an indication of device or OS capabilities. There is usually a more reliable method of checking whether a particular feature or class is available. For example, you can check if UIPopoverController is available on the current device usingNSClassFromString:
if(NSClassFromString(@"UIPopoverController")) {
    // Do something
}
Some classes, like CLLocationManager and UIDevice, provide methods to check device capabilities:
if([CLLocationManager headingAvailable]) {
    // Do something
}
Apple uses systemVersion in their GLSprite sample code, so my recommendation can't be absolute:
// A system version of 3.1 or greater is required to use CADisplayLink. The NSTimer
// class is used as fallback when it isn't available.
NSString *reqSysVer = @"3.1";
NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending)
    displayLinkSupported = TRUE;

Monday, March 11, 2013

VK photo wall


NSString *saveWallPhoto = [NSString stringWithFormat:@"https://api.vk.com/method/photos.saveWallPhoto?owner_id=%@&access_token=%@&server=%@&photo=%@&hash=%@", user_id, accessToken,server,photo,hash];
    saveWallPhoto = [saveWallPhoto stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSDictionary *saveWallPhotoDict = [self sendRequest:saveWallPhoto withCaptcha:NO];
http://habrahabr.ru/post/133504/

Sunday, March 10, 2013

Selector

В общем, вся идея классов Obj-С крутится вокруг специальной таблицы, которая имеет грубо говоря имя метода и указатель на обработчик. В режиме выполнения при каждом вызове эта таблица обходится и ищется метод по имени. Система гибкая, но медленная. Хотя пишут, что все сделано, чтобы работало моментально. И не имя хранится, а хеш (селектор) и кеш используют. Эту таблицу можно модифицировать при помощи категорий. Селектор может выступать как отдельный тип. Грубо говоря, селектор-указатель на функцию (метод класса) можно хранить в поле другого класса и вызывать его, минуя операцию посылки сообщения с обходом таблицы и вытекающими расходами ресурсов.

Smooth Freehand Drawing on iOS - Рисование

Tuesday, March 5, 2013

Cut NSString


\\просто обрезать 100 первых символов
        NSRange stringRange = {0,100};
        NSString *shortString = [myText substringWithRange:stringRange];
        NSString *twiStr = [[NSString alloc] initWithFormat:@"%@...", shortString];


\\обрезать до определенного символа
        NSRange newLineRange = [myText rangeOfString: @"\n\n"];
        NSRange stringBeforeNewLineRange = NSMakeRange(1, newLineRange.location);
       
        NSString *resultString = [myText substringWithRange:stringBeforeNewLineRange];
        NSLog(@"%@rrrrrrrrr@", resultString);