iphone

Need to present a modal view immediately on app start-up, but it doesn't appear

There are times when my application needs to present a modal view immediately after start-up. I have a method on my main view controller showEntryView that presents the modal view successfully in response to a button press. I also call showEntryView when my main view controller receives viewDidLoad, but in this case the view does not app...

UIViewContainer with UITableVIewContainer subView, UITableViewContainer.View leaves gap at top

I have a UIViewController with a UISegmentedControl that swaps out one of 3 UITableViewControllers depending up the pressed segment selected. Everything works great, except the UITableViewControllers do not fill the entire available screen, but leave a gap at the top . ...

Is it possible to define an anonymous selector in Objective-C?

I'd like to be able to define an inline anonymous selector that a selector wherever a selector is needed as an argument. Is this possible, or do I have to just suck it up and define a method? Background: In my iPhone application I need to update my UI from another thread. To do this I use performSelectorOnMainThread:withObject:waitUnti...

How can I improve this piece of code?

Shark tells me that this is a hotspot for bad performance: double distanceA = fabsf(target - current); target is CGFloat current is CGFloat the rest of my calculations rely on double. Maybe there's some smarter way to do this anyways? ...

Performance improvements for the Open GL ES code in the CrashLanding sample code?

I'm making an iPhone game based on the CrashLanding sample code. The sample code includes some Open GL ES stuff (Texture2D and MyEAGLView). What are some ways to improve the performance of this code? I'm fine w/ making certain trade-offs to improve the performance... but I don't what these trade-offs might be. For example perhaps o...

Is there a faster way to compare two variables?

I have this piece of code where Shark tells me it's a performance bottleneck: CGFloat shortestDistance = (distanceA < distanceB) ? distanceA : distanceB; all these values are CGFloat. Is there a faster way to figure out which one is smaller and assign that to shortestDistance? Maybe even by reference instead of copying a value? How wo...

insertNewObjectForEntityForName:

Boy oh boy, do I have a question that should overflow your stack. I'm sorry, was that inappropriate? :) But seriously, the question is as follows: I set up an Entity using the XCode .xcdatamodel file editor. I created an entity called Person, added a few attributes, then generated a .m file to represent it. That all works fine. Now...

didSelectViewController of tabBarController is not working?

Hi, i have implemented Tab bar controller in IB.but when i write the following method in appdelegate.m , it is not called(i have put break point) when i tab ...?any help? - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController - (void)tabBar:(UITabBar *)tabBar didSelect...

exporting sqlite file - convert it to proprietary format

Hi, I have an sqlite file inside my iPhone app. I want the users to be able to export and import the file again, directly from the app to their desktop, for backup purposes. But I don't want them to directly access the sqlite file or the data from anywhere other than the iPhone. How do I convert the file to a proprietary format that is u...

bookmark a pdf programmatically in iphone app

Hello, i am new in the fraternity, I am developing a pdf reader. I am rendering pdf in a webview. Now I have to add bookmarks to this pdf like most of the other pdf readers which I have rendered. Can you suggest me how this can be done. Thnx in advance. ...

Help adding a backgroundView to UITableViewCell

I'm getting really desperate trying to add a UIImageView to UITableViewCell.backgroundView. All my efforts have resulted in this crappy rendering: It looks like the cell's label's white background is sitting on top of cell's background and covering portions of it. I tried setting the label's background color to clear, or some other c...

navigate to a specific page number of pdf document

Hello, I am developing a pdf reader, it reads large pdf files now I want to develop a system by which I can navigate among the pages of the documents. Can you suggest me some way of doing this. ...

How to use UIEdgeInsets property in Button in iphone.

I an new iphone application Developer and want to know how to use UIEdgeInsets property in button so please guide me. ...

Getting localized string NOT from the main bundle...

I have folders of images within a top-level folder in the Documents folder of my iPhone app. I want to place the necessary strings, or plist in each folder so I can return a localized string for each image. Prior to this I was just returning the name of the image file. Now I want to use the name of the image file as a key to get the l...

how to get to appdelegate from viewcontrollers' value ?

hi, i know how to access appdelegate's value inside Viewcontroller like YourDelegate *appDelegate = (YourDelegate *)[[UIApplication sharedApplication] delegate]; but i want simple method like this when i want to get value from viewcontroller to appdelegate(reverse order).....? any help...? suppose if i have one method in appdelate. ...

Checking if a nsstring matches another string

Suppose I have a string "167282". How can I check if the string contains "128"? Is there any provision to know the percentage of the 2nd string that matches the first string? (If all the characters of the 2nd string are present in the first string or not.) Please help and thanx in advance. ...

Is it possible to make persistent full-screen camera like System camera app?

I am building a custom camera app, and would like to have the camera view similar to the native camera app in iPhone. (i.e., picks videos as a non-modal view, stays in the camera view after each video taken. I found the retake and use views unnecessary). Is there any possible way to do it? Thanks. ...

how to get touch event on imageView of UITableViewCell ?

Hi, I want to get notifications when user single tap or double tap on imageView of UITableViewCell. I have been try to add a subview to imageView, and use touchesBegan:withEvent: in subview controller, but can't trigger the event I expected. How can I do the job ? ...

remove selected style on a DIV

I am doing iPhone development and I set a webview with a DIV. I added 'toucstart' 'touchend' 'touchmove' events to this DIV. But after I added these events, the DIV has a style (look at this video : http://www.bluefly.cn/mask1.swf ) when 'touchstart' (like 'mousedown'), any one knows how to remove this visual effect? ...

iphone problem receiving UDP packets

I'm using sendto() and recvfrom() to send some simple packets via UDP over WiFI. I've tried using two phones, and a simulator, the results I'm getting are: Packets sent from phones -> recieved by simulator Packets sent from simulator -> simulator recvfrom remains blocking. Packets sent from phones -> other phone recvfrom remains blocki...