Tag: cocoa touch

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 […]

How can I create a custom popup window for iPhone?

I want to create a custom popup window for iPhone which should look like this: What is the most correct way to implement this for iPhone and iPod devices?

Subclassing UITableViewCell correctly?

What is the difference between adding the subview to self and or to the content view? Subview added to self – (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { UIImage *img = [UIImage imageNamed:@”lol.jpg”]; UIImageView *imgView = [[UIImageView alloc] initWithImage:img]; [self addSubview:imgView]; [imgView release]; return self; } Subview added to contentView – (id)initWithFrame:(CGRect)frame { if […]

How can I dismiss a pushViewController in iPhone/iPad?

I need to make a button to dismiss the child view controller from a pushViewController. The action is exactly like the left (back) button on the top navigation bar. How can I dismiss a pushViewController? Which method should I use ? Thanks.