iphone

iPhone, how do I add a label so that text will be exactly center of the screen, vert and hotiz ?

I've got a view which is shown in landscape mode and I want to add a label which is int he center of the view both horizontal and vertically. CGRect frame = CGRectMake(0, 0, 400, 44); UILabel *lab = [[[UILabel alloc] initWithFrame:frame] autorelease]; lab.font = [UIFont boldSystemFontOfSize:16.0]; lab.textAlignment = UIT...

Using Instruments, how can I tell what is causing my iPhone app to freeze?

My iPhone app tends to 'freeze up' the UI when comes into the active state from the background. How can I use Instruments to find out the cause of the freeze? What instrument should I use? What are the key columns I need to look at in the Instruments panel? ...

How to get which annotation bubble clicked

Hi guys, I am creating annotation bubble buttons with the following code: -(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation { if ([annotation isKindOfClass:[MKUserLocation class]]) return nil; MKPinAnnotationView *view = [mapView dequeueReusableAnnotationViewWithIdent...

[iphone] Is there any way to get a callback when the cursor/blinker position changes in UITextField

I am trying to build a custom keypad whose labels are to be changed on the basis of position of cursor in the UITextField. Is there way to register a callback to the event when position of the cursor changes or something else to get the required. ...

iOS: How can i receive HTTP 401 instead of -1012 NSURLErrorUserCancelledAuthentication

I have a problem similar to the one described in the link below. http://stackoverflow.com/questions/2188099/nshttpurlresponse-statuscode-is-returning-zero-when-it-should-be-401 I use [NSURLConnection sendSynchronousRequest:returningResponse:error:] to get data from a server. When NSURLConnection receives the HTTP Code 401, it does not...

Presented modal navigationcontroller under current navigationcontroller iphone

Hi all, In my application the modal navigationcontroller that I am presenting is going under the current navigationcontroller so I'm not able to view the new navigationbar as it's disappearing under the current one. I'm presenting the modalview on self and not self.navigationcontroller because self.navigationcontroller doesn't present ...

How do I detect real network availability?

Hi when iPhone connects to a wireless router, and that router is not connected to the internet? i need to display an error message saying "check you internet connection" i tried the Reachability sample code. but no luck, http://developer.apple.com/library/ios/#samplecode/Reachability/Listings/ReadMe_txt.html when i disable the WIFI in ...

How to handle gestures for view, that contains a lot of child views, that also handle gestures?

I have a large calendar view, that contains a lot of child views, that represent some calendar entries. The child views should respond to tap, tap-n-hold, double-tap. But, I want a large calendar view also respond to such gestures as pinch-to-zoom and swipe, even if a finger crosses somehow child views. By now, there is an overlaying tr...

adjacent date element in array

Hi friends how to compare an adjacent array element that contains date. The thing is when i compare BOOL day = [[temp_date objectAtIndex:k] compare:[temp_date objectAtIndex:k+1]]; it throughs the following expection * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSCFArray objectAtIndex:]: index (23) be...

Best way to check for variable's class in objective C?

I have an object which I am not sure is an NSString or not (could be NSNull, for example when reading a json into an NSDictionary) and I would like to get an NSString* if it is a valid string, nil otherwise. Is there an accepted way of doing this except writing my own function? +(NSString*)stringWithMaybeString:(id)maybeString { if...

display ALAssetPropertyDate in UILabel using AssetsLibrary in objective C

hi, i'm using the following code to get the property date of the video but the problem is it return as NSdate and when i tried to assigned it to UILabel.text in UItable the program crash on me. Can anyone help me? void (^assetEnumerator)(struct ALAsset *,NSUInteger, BOOL *) = ^(ALAsset *result, NSUInteger index, BOOL *stop){ if(re...

Implement page curl on android?

I was surfing the net looking for a nice effect for turning pages on Android and there just doesn't seem to be one. Since I'm learning the platform it seemed like a nice thing to be able to do is this. I managed to find a page here: http://wdnuon.blogspot.com/2010/05/implementing-ibooks-page-curling-using.html - (void)deform { Vertex...

How i can upload video to web service through XML parsing?

This is the code that i use for upload the video to web server -(void)startParsingForVedioUploade:(NSMutableDictionary*)vedioDict{ NSURL *videoURL = [vedioDict valueForKey:@"VideoUrl"]; NSData *myData = [[NSData alloc] initWithContentsOfURL:videoURL]; NSString *urlString = [NSString stringWithFormat:@"http://www.Example.c...

How can I make sure that UIViewController will not resize my view?

In my app, I have smaller sections where I want to use the MVC pattern to control these. So for example on one screen I have 3 UIViewController instances with their views visible at the same time. From what I know, UIViewController is only good for fullscreen usage. Someone said it can occassionally resize it's view without warning, for...

UDP socket starting to fail to receive

I have a very annoying bug showing up. We have left our iPhone app running overnight. Every 2 seconds it sends a broadcast ping out on to the network via the open socket to inform that the device is alive. Now the other application detects that ping and attempts to send messages back. The problem is that despite the ping continuing...

Determine the section of the tabbed UITextField

This is a tricky one: I have: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { ... //Textfield: UITextField *theTextField = [[UITextField alloc] initWithFrame:CGRectMake(200, 10,self.tableView.frame.size.width - 250, 30)]; theTextField.adjustsFontSizeToFitW...

directoryContentsAtPath deprecated iOS 4

I am using directoryContentsAtPath: which is deprecated in iOS 4 what to use instead this?? Thanks ...

adding video in iphone

i am new to iphone . i need sample code for how to add video files in iphone. ...

initialize event in EKEventEditViewController

My code is following EKEventEditViewController *addController = [[EKEventEditViewController alloc] initWithNibName:nil bundle:nil]; // set the addController's event store to the current event store. addController.eventStore = self.eventStore; // present EventsAddViewController as a modal view controller [self presentModalViewControll...

iphone : revoke distribution certificate and push notifications

I have an iPhone app with push notifications enabled and it's working pretty well. But my mac mini just "died" and I realize I did forgot to backup my public / private keys :/ So I guess my only solution now is to create new certificates (both developer and distribution) so I can continue my work ... but what happens with my push notific...