iphone

How to determine the startdate (monday) of a week with a predefined date?

My example date is 08.10.2010 (friday), so the startdate should be 04.10.2010 (monday). NSDate *today = [[NSDate alloc] init]; NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDateComponents *weekdayComponents = [gregorian components:NSWeekdayCalendarUnit fromDate:today]; NSDateComponents ...

Evaluating server certificate

Hi, How can I detect a self signed certificate from a revoked or expired ones? I'm using NSURLConnection and implementing connection:didReceiveAuthenticationChallenge: on delegate: - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge{ if ([challenge.protectionS...

Decode images in background thread?

Hello! I have a background thread that loads images and displays them in the main thread. I noticed that the background thread has almost nothing to do, because the actual image decoding seems to be done in the main thread: So far I’ve tried calling [UIImage imageNamed:], [UIImage imageWithData:] and CGImageCreateWithJPEGDataProvider ...

% sign in string objective c

i am wondering how i do a % sign within a NSString, i have tried \% and \\% ...

touchesBegan Event Stops Firing After a Lot of Scrolling

I have a series of UITableViews displayed in a horizontal ScrollView. Inside each tableview, each TableViewCell consists of 2 thumbnail tiles which represent a detail view. I am using touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event to catch when one of the tiles has been tapped. From there, I am pushing a detail view onto the Na...

iPhone Keyboard layout on webapp.

While filling out HTML formulars, the iPhone Keyboard has a black bar on top with the buttons "Back", "Next" and "Done". This bar isn't present on native apps. I would like to know if there is a way to change the iPhone layout on a webapp in order to hide the bar? ...

How to develop an universal app for iPhone + iPad without xib files?

I want to make an universal build, but I create my UI entirely programmatically. 1) Can I add my different view controller classes to the device-specific resources directories? Or must classes be shared along both devices? 2) If I must share the classes along both devices, what's the safest way to conditionally load classA or classB de...

MPMusicPlayerController not posting notifications?

I"m trying to use the MPMusicPlayerController to play music, and I also want to receive the notification MPMusicPlayerControllerPlaybackStateDidChange. I set up my player and notification registration pretty much just like the sample (which works, BTW - it receives notifications correctly): - (id) initWithPlaylist:(MPMediaPlaylist*)lis...

How to fix strange retain count (1 init - 3 retaincount)? + edit: dealloc problem

So my code goes like this: ArticleControllerController *ac = [[ArticleControllerController alloc] init]; ac.categoryIndex = idx; NSLog(@"acc retain: %d", [ac retainCount]); [app.nav pushViewController:ac animated:NO]; NSLog(@"acc retain: %d", [ac retainCount]); [ac release]; NSLog(@"acc retain: %d", [ac retainCount]); ...

A table that allows some cells to be checkmarked..??

i am new to iphone development.. i am making an application in which table view list the names of countries... user has to select one or more countries at a time..i want to display the checkmark disclosure button at the entries that are selected..how can i do that.. and another thing..i want to deselect the entry when user again clicks...

How to create opengl texture from text generated by method 'drawAtPoint: withFont:'

Hi, I am trying to render texture dynamically in my opengl application. Basically I am tring to use (CGSize)drawAtPoint:(CGPoint)point withFont:(UIFont *)font and capture it to a texture. But I am not able to figure out how to convert CGContext stuff to texture. ...

Relationships in CoreData

I am quite new to core data I have read a couple of articles on Apples dev site & now am somewhat confortable with using it with one entity. Now I am working on an app that recommends recipes to users. The datadesign is somewhat like this I have these entities Item , Pantry & Recipe . Relations are as follows: ...

UIButton event 'Touch Up Inside' not working. 'Touch Down' works fine.

I've got a UIButton in a UIView, which is in a UIViewController that I've allocated and inited from a .xib file. When hooking an IBAction up to the 'Touch Down' event of a UIButton it triggers correctly. But if I hook it up to the 'Touch Up Inside' event it doesn't respond. Other events don't work either. 'Touch Drag Enter', 'Touch Dra...

iOS device goes idle, network stops. How do i get notified about entering the 'idle' state?

My app has a screen where it is constantly polling a server for information. When the user does not interact with the app it goes idle, the screen goes dim and then black. In the background, the app still tries to poll to service, but gets -1009 error codes from NSURLConnection. (-1009 == NSURLErrorNotConnectedToInternet) My idea is to...

Problem with iPhone memory leaking

I have a piece of Objective-C code I've inherited and the leak tracking tool has identified a memory leak in the code. I am not entirely up on the memory tracking rules of Objective-C so I'm having a real problem with understanding why the memory is leaking. The code is as follows: + (NSString *) getRecordingsDirectory { NSArr...

Conversion NSString to NSDate. 1 day is lost.

NSString *dateString = @"20.10.2010"; NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; [dateFormatter setDateFormat:@"dd.MM.yyyy"]; [dateFormatter setLocale:[NSLocale currentLocale]]; NSLog(@"%@", [dateFormatter dateFromString:dateString]); My output is: 2010-10-19 22:00:00 GMT Why is one day lost? ...

How can you use Game Center with your Game

How can you use Game Center's Highscores and Achievements Server with your app? ...

[iphone] custom keyboard - how to dispatch event which signals the UITextField to update the text accordingaly

I am trying to create a custom keypad through a collection of buttons, which function like a regular keypad provided in iphone. Now series of action that should occur -text field is selected -user presses the button -text field is designated as first responder -something like key event is launched so that text field is updated according...

Detect Double tap in UIScrollView

Hi All, How can I detect double tap in UIScrollview? I tried: -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch = [touches anyObject]; if (touch.tapCount == 2) { // some operations here } } But this is not detecting double tap in UIScrollView, is there any other way to detect do...

"unrecognized selector" within a simple internal call

I would like my custom controller (opened by a UITabBarController) to immediately load a UIImagePickerControllerSourceTypeCamera as soon as it is loaded. To achieve this, I added a method - acquirePhoto() and I'm trying to call it from within the - viewDidLoad() but this is causing the error above. This is the call: - (void)viewDidLoad...