Tag: cocoa touch

How can I present a picker view just like the keyboard does?

I want a UIPickerView to show up when I press a button (just like keyboard) and then go away when user taps anywhere on the screen. How can I do this? Thanks. A bit more background: I have a UITextField called months in UITableViewCell. Now the best option for me is to put a UIPikcerView […]

Which iOS classes that don't support zeroing weak references?

Is there a list of classes in iOS that can’t be referred with a __weak pointer when using automatic reference counting (ARC)? Apple’s Transitioning to ARC Release Notes only lists Mac classes so far: Which classes don’t support zeroing-weak references? You cannot currently create zeroing-weak references to instances of the following classes: NSATSTypesetter, NSColorSpace, NSFont, […]

NSCalendar getting day difference wrong

I’m trying to use [[NSCalendar currentCalendar] ordinalityOfUnit:NSDayCalendarUnit inUnit:NSEraCalendarUnit forDate:date] on two different dates to see if they fall on the same day. However, if my time zone is different (say, somewhere in Germany), even though the dates are obviously the same, the days returned are different. If I use NSYearCalendarUnit instead of NSEraCalendarUnit on the […]

How to check if there's a performSelector: waiting to be executed?

In my iPhone app I got several places where I can do a [object performSelector: withObject: afterDelay:] call. All lead to the same method. Now, in that method I want to execute some code only on the latest call of it. If it was the first, I could just do [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(thisMethod) object:nil] and […]

UISegmentedControl selected state icon image

How can I set the icon image for selected state of the UISegmentedControl. Is the UISegmentedControl really missing this functionality or it is just me missing skills? Is there any workaround to do it? Any answer appreciated. Cheers, Rafal

Proper way to add a title to a modal view controller's toolbar?

Right now I’m using this in my -viewDidLoad method: UIToolbar *toolbar = [[UIToolbar alloc] init]; UIBarButtonItem *flexibleSpace = [UIBarButtonItem alloc]; flexibleSpace = [flexibleSpace initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; // Add a back button to allow user to close the modal view NSString *back = NSLocalizedString(@”Back”, nil); UIBarButtonItem *backButton = [UIBarButtonItem alloc]; backButton = [backButton initWithTitle:back style:UIBarButtonItemStyleDone target:self […]

How can I use a UIButton in a UICollection supplementary view?

I am attempting to place a UIButton in a UICollectionView supplementary view (footer). I have connected the UIButton using storyboards to a subclass of UICollectionViewCell and can change it’s properties programmatically including the background image. However, when I wire up the touch up inside event of the button to a method, it does not fire. […]

How to take Picture Programmatically in iphone App using device camera?

In iPhone App, Can we take pictures at some perticular time intervals programmatically by using iphone device camera ? If yes then please let me know how we can take pictures programmatically in iPhone App? Please Help and Suggest. Thanks,

How to implement “group by values” in NSMutableArray?

I am using NSMutableArray. I want to fetch the values by date like we do in SQL group by “log_date”. logMuArray ( { “log_currenttime” = “4:30pm”; “log_date” = “11.12.2011”; “log_duration” = “1:30”; }, { “log_currenttime” = “4:33pm”; “log_date” = “11.12.2011”; “log_duration” = “2:21”; }, { “log_currenttime” = “4:40pm”; “log_date” = “11.12.2011”; “log_duration” = “5:30”; }, […]

What's the use of iCloud Display Sets?

When adding iCloud support to iOS app one can configure iCloud Display Set and link it with an app by specifying NSUbiquitousDisplaySet. But iCloud works even without it, so my question is: what’s the purpose of iCloud Display Sets at all? Couldn’t find any clear answer anywhere in the docs. And what’s more, based on […]