http://stackoverflow.com/questions/5329648/display-local-uiimage-on-uiwebview
Wednesday, September 11, 2013
Tuesday, August 27, 2013
Friday, August 23, 2013
Saturday, August 17, 2013
Friday, August 9, 2013
Wednesday, August 7, 2013
Wednesday, July 24, 2013
Block example
в классе
- (NSArray *)loadTitles
{
NSMutableSet *set = [NSMutableSet set];
NSArray *lists = [List findAll];
for (List *list in lists) {
NSSet *titles = [list.items select:^id(id element) {
ListItem *item = element;
return item.title;
}];
[set addObjectsFromArray:titles.allObjects];
}
return [set.allObjects sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
}
- (void)loadTitlesWithAction:(ArrayBlock)action
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSArray *titles = [self loadTitles];
dispatch_async(dispatch_get_main_queue(), ^{
if (action)
action(titles);
});
});
}
вызов в другом классе
// пример использования метода с блоком
// вызываем метод и передаем блок, которые вызовется, когда метод закончится
// в итоге получаем то же, что и с делегатом, но без мороки с делегатом
self.allItemsInListForAutoComplete = [[AllItemsInList alloc] init];
[self.allItemsInListForAutoComplete loadTitlesWithAction:^(NSArray *arr) {
self.titleItemForAutoCompleteArray = arr.mutableCopy;
[self.autocompleteTableView reloadData];
}];
Tuesday, July 23, 2013
Cocos2D
http://www.aspyreapps.com/blog/using-cocos2d-in-a-uikit-project/
Using Cocos2D in a UIKit project
Friday, July 19, 2013
Wednesday, July 17, 2013
Tuesday, July 16, 2013
section UITableView not stopped
1) UITableViewStyleGrouped
2) tableView.backgroundView = nil;
3) в cellForRow...
cell.backgroundView = [[[UIView alloc] initWithFrame:cell.bounds] autorelease];
4) в layoutSubviews ячейки
self.contentView.frame = self.bounds;
2) tableView.backgroundView = nil;
3) в cellForRow...
cell.backgroundView = [[[UIView alloc] initWithFrame:cell.bounds] autorelease];
4) в layoutSubviews ячейки
self.contentView.frame = self.bounds;
resize iPad
- (void)viewDidLoad
{
[super viewDidLoad];
smokeKillYou = [[UILabel alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - 108 , self.view.frame.size.width, 108)];
smokeKillYou.numberOfLines = 1;
smokeKillYou.font = [UIFont fontWithName:@"Arial" size:100];
smokeKillYou.textColor = [UIColor blackColor];
#warning шрифт не тот
smokeKillYou.text = @"TEST";
smokeKillYou.textAlignment = NSTextAlignmentCenter;
// smokeKillYou.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth;
[self.view addSubview:smokeKillYou];
[smokeKillYou release];
}
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
[self resizeWithInterfaceOrientation:toInterfaceOrientation];
}
- (void) resizeWithInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation
{
CGFloat width = UIInterfaceOrientationIsLandscape(interfaceOrientation)? 1024 : 768;
CGFloat height = UIInterfaceOrientationIsLandscape(interfaceOrientation)? 768 : 1024;
smokeKillYou.frame = CGRectMake(0, height - 108 , width, 108);
}
Monday, July 15, 2013
MagicRecord sync CoreData
http://www.verious.com/qa/multiple-databases-with-magical-record-or-sync-only-part-of-database-to-i-cloud/
http://stackoverflow.com/questions/14069730/multiple-databases-with-magicalrecord-or-sync-only-part-of-database-to-icloud/14073041#14073041
https://github.com/magicalpanda/MagicalRecord/issues/127
http://stackoverflow.com/questions/12012015/syncing-core-data-across-multiple-devices-using-icloud
http://vimeo.com/62917609
http://stackoverflow.com/questions/14069730/multiple-databases-with-magicalrecord-or-sync-only-part-of-database-to-icloud/14073041#14073041
https://github.com/magicalpanda/MagicalRecord/issues/127
http://stackoverflow.com/questions/12012015/syncing-core-data-across-multiple-devices-using-icloud
http://vimeo.com/62917609
Sunday, July 14, 2013
Thursday, July 11, 2013
Tuesday, July 9, 2013
Monday, July 1, 2013
Saturday, June 29, 2013
Wednesday, June 26, 2013
ВКонтакте iOS SDK
http://habrahabr.ru/post/184560/
Найти самую актуальную версию можно по этой ссылке: GitHub (https://github.com/AndrewShmig/Vkontakte-iOS-SDK )
https://github.com/AndrewShmig/Vkontakte-iOS-SDK-v2.0/issues?labels=Future+features&state=open
Найти самую актуальную версию можно по этой ссылке: GitHub (https://github.com/AndrewShmig/Vkontakte-iOS-SDK )
https://github.com/AndrewShmig/Vkontakte-iOS-SDK-v2.0/issues?labels=Future+features&state=open
Wednesday, June 19, 2013
Thursday, June 13, 2013
set gradient mask
- (void)setMask{
CAGradientLayer *mask = [CAGradientLayer layer];
mask.locations = @[@0.0, @0.80f, @0.98, @1.0f];
mask.colors = @[
( id)[UIColor whiteColor].CGColor,
( id)[UIColor whiteColor].CGColor,
( id)[UIColor clearColor].CGColor,
( id)[UIColor clearColor].CGColor
];
mask.frame = _webView.bounds;
mask.startPoint = CGPointMake(0, 0);
mask.endPoint = CGPointMake(0, 1);
_webView.layer.mask = mask;
}
Saturday, June 8, 2013
Thursday, June 6, 2013
Thursday, May 30, 2013
сортировка массива
[_dataArray removeAllObjects];
NSArray *athele = [sportResult.matchDetails objectForKey:@"athleteResults"];
if ([athele isKindOfClass:[NSArray class]]) {
[_dataArray addObjectsFromArray:[athele sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
int rank1 = [[NSString validateString:[obj1 objectForKey:@"rank"]] integerValue];
int rank2 = [[NSString validateString:[obj2 objectForKey:@"rank"]] integerValue];
if(rank1 == 0) return NSOrderedDescending;
if(rank2 == 0) return NSOrderedAscending;
return [@(rank1) compare:@(rank2)];
}]];
}
проверить на соответствие одного объекта, объктам в массиве
NSString *runningAthlete1 = [[[[sportResult.matchDetails objectForKey:@"unitInfo"] objectForKey:@"currentPair"] objectForKey:@"innerAthlete"] objectForKey:@"odfCode"];
NSString *runningAthlete2 = [[[[sportResult.matchDetails objectForKey:@"unitInfo"] objectForKey:@"currentPair"] objectForKey:@"outerAthlete"] objectForKey:@"odfCode"];
NSString *runningAthlete3 = [[[[sportResult.matchDetails objectForKey:@"unitInfo"] objectForKey:@"nextPair"] objectForKey:@"innerAthlete"] objectForKey:@"odfCode"];
NSString *runningAthlete4 = [[[[sportResult.matchDetails objectForKey:@"unitInfo"] objectForKey:@"nextPair"] objectForKey:@"outerAthlete"] objectForKey:@"odfCode"];
NSArray *currentAthletes = @[runningAthlete1,runningAthlete2,runningAthlete3,runningAthlete4];
for (int i = 0; i < fullListAthletes.count; i++) {
if ([currentAthletes containsObject:[[[fullListAthletes objectAtIndex:i] objectForKey:@"athlete"] objectForKey:@"odfCode"]]) {
[fullListAthletes removeObjectAtIndex:i];
i--;
}
NSLog(@"123");
}
Tuesday, May 28, 2013
Wednesday, May 22, 2013
Thursday, May 16, 2013
Wednesday, April 24, 2013
everything symbol small or big
[myStr uppercaseString];
[myStr lowercaseString];
[myStr lowercaseString];
Tuesday, April 23, 2013
Sunday, April 21, 2013
Friday, April 19, 2013
Thursday, April 18, 2013
Monday, April 15, 2013
Saturday, April 13, 2013
Friday, April 12, 2013
UILabel в цикле
NSUInteger i = 0; for (i=0; i<[elements count]; i++){ UILabel *label = [[UILabel alloc] init]; NSString *tempName = [NSString stringWithFormat:@\"label%d\", i+1]; label.tag = tempName; [label release] }
Thursday, April 11, 2013
tag define
#define LABEL_TAG_OFFSET 100
#define LINE_TAG_OFFSET 200
((UIImageView*)[self.contentView viewWithTag:i +LINE_TAG_OFFSET]).image = [UIImage imageNamed:@"bluepolos.png"];
Wednesday, April 10, 2013
Monday, April 8, 2013
UILabel в цикле
NSUInteger i = 0; for (i=0; i<[elements count]; i++){ UILabel *label = [[UILabel alloc] init]; NSString *tempName = [NSString stringWithFormat:@\"label%d\", i+1]; label.tag = tempName; [label release] }
UITableView. Hide cell, with button in section
UITableView: Display and hide cells as a dropdown list
layoutSubviews
Метод вызывается при работе с ячейкой в UITabliView
В нем можно переопределять фреймы, если например какого-то объеткта не пришло, каратинки например, тогда фрейм другого объеткра сменить
getter
-(UILabel *)scoreFirstLabel
{
if (!_scoreFirstLabel) {
_scoreFirstLabel = [[[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(_winnerFierstImageView.frame) +1, CGRectGetMinY(_winnerFierstImageView.frame) +2, 20, 10)] autorelease];
_scoreFirstLabel.textColor = RGBA(32, 43, 68, 1);
_scoreFirstLabel.numberOfLines = 1;
_scoreFirstLabel.font = [UIFont fontWithName:@"EtelkaText" size:10];
_scoreFirstLabel.backgroundColor = [UIColor clearColor];
[self.contentView addSubview:_scoreFirstLabel];
}
return _scoreFirstLabel;
}
Saturday, April 6, 2013
Monday, April 1, 2013
Sunday, March 31, 2013
Friday, March 29, 2013
Tuesday, March 26, 2013
Monday, March 25, 2013
Saturday, March 23, 2013
Add UITextField Programmatically
CGRect textFieldFrame = CGRectMake(0.0, 0.0, 100.0, 30.0);
UITextField *txtField = [[UITextField alloc] initWithFrame: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]];
Friday, March 22, 2013
iOS Dev: Customize UITextField and UITextView
http://nullpointr.wordpress.com/2012/02/28/ios-dev-customize-uitextfield-and-uitextview/
http://dribbble.com/shots/18320-iPhone-Login Very good textField
http://stackoverflow.com/questions/5094907/custom-uitextfield
http://dribbble.com/shots/18320-iPhone-Login Very good textField
http://stackoverflow.com/questions/5094907/custom-uitextfield
CALayer *imageLayer = textView.layer;
[imageLayer setCornerRadius:10];
[imageLayer setBorderWidth:1];
imageLayer.borderColor=[[UIColor lightGrayColor] CGColor];
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];
Subscribe to:
Comments (Atom)