iphone

Why doesn't initWithNibName work for my UIViewController subclass?

I have subclassed UIViewController into a new class, PageViewController (I'm writing a simple book app). I want to add a new view loaded from a nib file and am using the following code. It works. PageViewController *viewController1 = [[UIViewController alloc] initWithNibName:@"Page1" bundle:nil]; [viewController1.view setUserInteraction...

iPod Library access in iPhone OS 3.0

One of the new developer features in version 3.0 of the iPhone OS allows users to select music from their own library to listen to within applications via the MPMediaPickerController class. Is there a way to make the media picker appear in landscape mode for applications that support this device orientation? ...

Make AVFoundation framework not fading when screen fades

Hi I am implementing some audiobooks for iPhone. I used AVFoundation. Something like this: NSString *path = [[NSBundle mainBundle] pathForResource:@"intro" ofType:@"mp3"]; player=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL]; I have a problem. When the screen goes dark (single audio files ...

iPhone short animation: video or image sequence?

I have read several post on both matters but I haven't seen anyone comparing so far. Suppose I just want full screen animation without any transparency etc, just a couple of seconds animation (1''-2'') when an app starts. Does anyone know how "video" compares to "sequence of images" (320x480 @ 30) on the iPhone, regarding performance et...

Audio volume stuck at low level and adjusting volume has no effect?

When I use my app (on the device), the actual volume works OK for a while, but after a few days it seems to get 'stuck' at a low level. Adjusting the volume rocker has no effect - and it show 'Ringer' text... I've noticed that other people's apps are similarly affected if they show the 'Ringer' text when adjusting the volume. But apps w...

How to use Core Data in saving all the details which were stored or displayed in a table view?

Hi Guys I am developing an app which parses an Xml or RSS feeds of a magazine..The thing is I have to include an offline capability,ie save the previous results which were displayed in each cell(similar to the New York times app) and then display the saved ones when there is no network connection.. Please help me with the codewise expl...

UILabel place as portrait

I create a label in my iPhone application as: UILabel * lab=[[UILabel alloc]initWithFrame:CGRactMake(100.0,100.0,100.0,10.0)]; lab.text=@"1 2 3 4 5 6 7 8 9 0"; And also added window as subview. Now this label appearing in my view as: 1 2 3 4 5 6 7 8 9 0 I want it as: 1 2 3 4 5 6 7 8 9 0 I mean it will appear as portrait mode. Is ...

iPhone development using sprites

I want to create an iPhone/iPod game. I want it to be 3d, but I want to use sprites instead of OpenGL to do this (I assume this would be easier since I don't know OpenGL). I was thinking of simply layering sprites over top of each other and changing their size to give an illusion of 3d. It doesn't need to be too convincing since the gam...

Two images intersection transparency

There are two images. image1 and image2. I have added image2 on image1. Overall the output image must be image1 only but, the portion of the image2 must become transparent. I mean the alpha values on the intersection area must be in reverse order( i.e, if alpha value of one pixel( say 120, 100) on image2 is 1.0 then the same pixel's alph...

iPhone performance with Bitmaps

Pretty new to iPhone / objective-C. I have an application that has 15-100 small images (16x16 or 8x8 PNG) on the screen. For this example sake, let's assume that I can create these images using CGContext if I needed to. I would have to assume that iPhone would perform better using that method rather than loading images (PNG's). H...

Optimizing a Cocoa/Objective-C search

I'm performing a search of a large plist file which contains dictionaries, tens of thousands of them, each with 2 key/string pairs. My search algorithms goes through the dictionaries, and when it finds a text match in either of the strings in the dictionary, the contents of the dictionary are inserted. Here is how it works: NSDictionary...

How to get rid of the date and time that appears before every NSLog statement in the console

Hi, I use NSLog in my application. And I'd like to get rid of the annoying beginning of each string: "2009-07-01 21:11:06.508 MyApp[1191:207]". Is there a way to do so? Probably another logging function? Thanks. ...

iPhone: Logging to a file

Hi, I want to log my log strings to a file. I implemented the following method: void QuietLog (NSString *format, ...) { if (format == nil) { printf("nil\n"); return; } va_list argList; va_start(argList, format); NSMutableString *s = [[NSMutableString alloc] initWithFormat:format ...

How does HTTP Adaptive Bitrate Streaming work on the iPhone?

Apple has included HTTP Adaptive Bitrate Streaming in the iPhone OS 3.0, in particular Safari handles this automatically. I'd like to play with this in a low cost manner, but I expect it'll require a custom HTTP server in the worst case, and interesting PHP/etc scripting in the best case. But first I need to know what the protocol diff...

UIWebView needs to load URL with ID from device

Hello, I have a UIWebView that I need to load a page with a specific URL that pulls a number from the users iPhone. I have the following code UIDevice *myDevice = [UIDevice currentDevice]; NSString *deviceUDID = [myDevice uniqueIdentifier]; [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://mysite.com...

Filter NSFetchedResultsController for nil value?

I have a NSFetchedResultsController which is fetching objects from a NSManagedObjectContext. These objects have a lastOpened property, which is initially nil and is only set when they are viewed. I want my UITableView to display a list of the most recently opened objects, which I can do by adding a NSSortDescriptor to the NSFetchReque...

Combine lots of texture atlas draw calls with OpenGL ES

I have a large texture atlas and I'm drawing lots of textures on the screen from this. At the moment each texture from the atlas is drawn separately with code like this: GLfloat coordinates[] = { bla, bla, bla, bla, bla, bla, bla, bla }; GLfloat vertices[] = { bla, bla, bla, bla, bla, bl...

iPhone, hook for edit/done button click in table view

In my table view controller there is self.navigationItem.leftBarButtonItem = self.editButtonItem; which produces a regular edit/done button at the top left corner. Hence, once the user clicks "Edit", the button caption changes to "Done" and the table entries may be deleted or reordered. I would like to get notified once the user actua...

UIView's frame, bounds, center, origin, when to use what?

UIView has the concept of frame, bounds, center, and origin, and they all seem to be interrelated. Most of the time, I deal with frame when setting the position and size of a UIView (or subclass). I understand that the frame is using global coordinate system and the bounds is using coordinate of the local view (therefore it's x and y a...

Photo button like in contacts and Facebook app

How can I create a "person photo" button like the one in contact info or in the Facebook app? (grey and rounded border with a small radius and an image that is cropped inside it) Edit: It must obviously work for all photos, not just one that I prerender in Photoshop. I guess I could do it manually using masks etc., but Facebook app do...