iphone

iPhone SDK: How to generate a random time of day

Hello all, I am having some problems trying to figure out the best way of generating a random time of day. For instance, if I want to choose a random time between the hours of 9am and 5pm, what would be the best way with the least amount of overhead on the device? I guess I need someone to point me in the right direction. Thanks! ...

How to change DNS settings in iPhone

Hello, I want to develop an application for iPhone. I have developed some apps before. I need to change DNS settings. Is it possible and how can I do and if it's possible, is it applicable only to wi-fi ? I want to change it for wi-fi and 3G, EDGE, etc. Thanks. ...

Moving UIButton around

I've tried to move a UIButton up and down in a menu. The problem I've got with the following solution is that the timer is not accurate. Sometimes the Button is moved up 122px, sometimes only 120px. How I can fix this? -(IBAction)marketTabClicked:(id)sender { if (marketTabExtended) { NSLog(@"marketTabExtended = YES"); ...

How to learn about iPhone jailbroken programming?

I'm interested in learning about what additional features and APIs an app has access to when an iPhone is jailbroken. Can someone provide me with some basic resources to learn about this? I would be most interested in: documentation on the private APIs filesystem layout app configuration, e.g. how did WinterBoard replace SpringBoard? A...

iPhone JSON object releasing itself?

I'm using the JSON Framework addon for iPhone's Objective-C to catch a JSON object that's an array of Dictionary-style objects via HTTP. Here's my connectionDidFinishLoading function: - (void)connectionDidFinishLoading:(NSURLConnection *)connection { [connection release]; NSString *responseString = [[NSString alloc] initWithData:res...

Does [UIWebView loadRequest] block the thread?

I've read up on UIWebView and can't find a specific answer to whether or not it can block a thread when loadRequest is called (like NSURL can). I've heard that there is a specific UIWebView thread that all UIWebView's try to load using (and as a result that thread will be blocked with a slow load), but will there be any effect on the mai...

Why does CTFontCreateWithName != NULL on iPhone OS 3.1.3?

I am following the instructions in the Apple dev docs: http://developer.apple.com/iphone/library/documentation/DeveloperTools/Conceptual/cross_development/Using/using.html#//apple_ref/doc/uid/20002000-1114537 In this case, I'm trying to conditionally execute code, depending on whether or not CTFontCreateWithName is defined. Here is what...

Why does this TableView code work?

I made a typo when creating a UITableViewCell with this code: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"CellIdentifier"; UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier]; ...

Mapkit: Only show annotations in current view

Instead of loading all annotations that are in my array, I would only like to load the annotations that the user could currently see cased on how far they are zoomed in on the map. So, if the user pans to a place where there are annotations, those would be added, and if they pan away, those would be removed. I assume this would help wi...

UINavigationController doesn't fully push view and only changes the Navigation toolbar to the next view's toolbar

So I have an iPhone application that utilizes a UINavigationController for setting up the views. When the application first starts, it presents the user with a UITableViewController and the user can select an item and it will push another view. Now I have it set so that my app remembers the user's last selection and automatically selec...

iPhone: How to Sync Data Between Two Tab View with One Button Action

Hello, I have an app which plays music files. The UI has two tab views. TabOne plays the song while TabTwo displays information about the song. I have a button which sets a global variable that identifies the song to be played. The song does play but the information displayed in TabTwo does not update. How do I ensure that both tabs u...

How to check if a BOOL is null?

Is there a way I can check to see if a value is NULL/Nil before assigning it to a BOOL? For example, I have a value in a NSDictionary that can be either TRUE/FALSE/NULL mySTUser.current_user_following = [[results objectForKey:@"current_user_following"]boolValue]; When the value is NULL I get the following error *** Terminating app ...

lazy loading images in UIScrollView

I have an application the requires scrolling of many images. because I can not load all the images, and save it in the memory, I am lazy loading them. The problem is if I scroll too quickly, there are "black images" showing (images that did not manage to load). this is the lazy loading code: int currentImageToLoad = [self cal...

Can I get an audio session / apply audio units to playback from MPMusicPlayerController?

Hi there, I'd like to take control of the audio coming from MPMusicPlayerController (i.e., playing from the iPod library). For example, I'd like to apply EQ to it or do DSP, reverb, that kind of thing. Is this possible? Is there an audio session that I can grab a handle on? Or, perhaps is there some way to play back files from the iPod ...

How to play the same Sound multiple times with overlap, using OpenAL or Finch?

Finch uses OpenAL. However, when I have an instance of Sound, and say -play, the sound plays. When I call -play multiple times one after another in a fast paced way, every -play makes the current sound playback of that sound stop and restart it. That's not what I want. Would I have to create multiple sources or buffers to get that worki...

UIScrollView calls layoutSubviews() each time its scrolled

Hi, I subclassed UIScrollView (IPhone SDK) and overrode the (void)layoutSubviews; method. I noticed that each time the scrollView is scrolled, this method is called. Is that the correct behaviour or do I have mistakes in my code? If it is the default behaviour, isn't this a performance killer? Sincerely, heinrich ...

iPhone: Accessing Composite Name in AddressBook Causes EXC_BAD_ACCESS

Hi everyone. I'm new to iPhone development and have a question I hope someone can help me with. I have a programmer working on an iPhone app for me and when I run the app in the simulator, it works great. But when I try to run it on my actual iPhone, I get a EXC_BAD_ACCESS error and the app locks up. Looking at the debugger, it's refe...

iphone: how to do Page turning

hi frnds, I am facing the problem from a month and didn't find anything from google.. I am using UIView for pdf display. there is no problem with pdf but problem is with transition. I have to turn each page of pdf with realistic page turn exp. I search, dig a lot about that but i didn't get anything that how to do that. I don't want t...

Leak in managedObjectContext save:

Hi I have the following piece of code and when I use Instruments/Object Allocations, it tells me that there is a leak there (which goes down to sqlite3MemMalloc). Is there something that I should release? if (![managedObjectContext save:&error]) { NSLog(@"Error while saving."); } The save works well and doesn't trigger an error. ...

Action sheet doesn't show Cancel button on iPad

On the iphone, this code shows the cancel button: - (IBAction)buttonPressed { UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Are you sure?" delegate:self cancelButtonTitle:@"No way!" ...