ios

Aligning multiple sized text vertical center instead of baseline with Core Text in iOS.

Is it possible to align multiple sized text by bounding center (of each size) instead of baseline? I tried CTRunDelegate feature, but it doesn't work. It was possible with CTRunDelegateCallbacks.getAscent and CTRunDelegateCallbacks.getDescent, but the feature doesn't work. Only CTRunDelegateCallbacks.getWidth worked. I succeed to laying...

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 ...

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...

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...

Layout Manager, or is there a better solution?

I have a table view where cells can display a variable amount of information. For example, the first cell could display 2 labels, the next cell 5 labels, and the third cell could display 1 label. The cell contents are stored in managed objects. I would like to make this data driven, where I have a plist to configure the cells. I'm think...

When creating an iOS app (Xcode), how can I turn off the automatic icon 'gelling'

Is there a way to get rid of the highlight that is automatically added to the icon when creating an iphone app, or will I have to compensate by hand in PS? Thanks ...

How should I store UIImages within my Core Data database?

I am developing an application which demands around 100 images or maybe more to be pre-inserted into the Core Data database along with other related information. Now I can easily add other data by just writing a few lines of code but for UIImages I am unsure how to do it without writing a lot of code. I was wondering: is there anyway t...

How to do peer-to-peer communication in an iPhone app?

I'm trying to write a simple chat application for the iPhone (as an experiment). Is there a simple way for two devices to discover each others' IP addresses, and given the addresses is there a simple API or protocol that would let me send text messages back and forth? I've investigated SIP (specifically Sofia and eXosip), but these too...

Getting current device language in iOS?

I'd like to show the current language that the device UI is using. What code would I use? I want this as an NSString in fully spelled out format. (Not @"en_US") ...

drawRect: isn't working.

I want to place some "handles" on a UIView I have on-screen. So, I'm creating more UIViews, one at each corner of the UIView's frame rectangle, and I simply want to draw a circle that "fills" the rectangle that is the frame of the "handle" UIView. Here's what I mean: How I create the "HandleView": CGPoint upperLeft = CGPointMake([[se...

Hierarchy of iOS App UI

I am getting confused reading about CALayers, UIViews and View Controllers. Can someone explain the relationship each of those have to each other (and include anything I might have missed?). I am particularly interested in a View that may have more than one layer. Does that mean the the View Controller has multiple UIViews or that the U...

how to autoplay next song in music application when first song completes playing

Hi to all, I have made a music app using avtouchController & I want to play my next song one after the other using autoplay can u please give me the step to autoplay a song. ...

Radial gradient draw performance - Can OpenGL-ES improve?

I'm working on a image manipulation app that overlays a radial gradient over an image loaded from the photo library. On screen I have a slider to dynamically in/decrease the radius of the radial gradient. I've found the performance on the simulator to be just fine, but on an iPhone 3G or 3GS it is much slower to redraw when moving the s...

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...

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...

How do I set Basecamp credentials using apple IOS for iPad

I'm trying to request my company's Basecamp info for an internal project we're building. I understand how to add credentials in an ASP.NET environment but I'm new to iPad development and can't seem to get an appropriate response from Basecamp. Here's what I'm doing: NSMutableURLRequest *theRequest=[NSMutableURLRequest requestWithURL:[NS...

Confused why one piece of code works and another doesn't in Objective C

Sorry about the title being extremely vague, I'm new to Objective C and struggling a little with it. Basically I have the following section of code: Graph *graph1 = [[Graph alloc] init]; [graph1 addNode:@"TEST"]; which is working to a degree. But I want to change it because the above code happens on a button press, and therefore I ass...

MPMoviePlayerController throws errors ONLY in universal app

My app plays a video in fullscreen mode when the app is started. Everything is working flawlessly from 3.0 to 4.1. However, if I compile the same code for a universal app, it will work on the iPad, but will not work on the iPhone (simulator) anymore. Has anyone solved this problem? Here's the code: if ([self respondsToSelector:@selec...

Help with iPhone sample code

I'm trying to build this iPhone sample: http://trac.pjsip.org/repos/wiki/Getting-Started/iPhone but I'm having trouble since I am new to both iPhone development and the Mac world. From the Build Preparation section, I've downloaded the source code, but step 2 here is to "set [my] config_site.h" to a particular value. Do I just double...