cocoa-touch

Transparent portion of view?

I am working through the iPhone_3 Development book by Dave Mark and I have a quick question arising from chapter_6 with regards to the way the UIToolbar is placed over the underlying view. In the example in the book there are 2 controllers with associated views (blueView & yellowView) and a 3rd switchController (UISwitchController). Bot...

UIScrollView Touches override

I want to know how I would stop my sublass o UIScrollView is not working properly: - (void) touchesShouldBegin:(NSSet *)touches withEvent:(UIEvent *)event inContentView:(UIView *)view { if ([touches count] == 2) { [super touchesShouldBegin:[touches anyObject] withEvent:event inContentView:view]; } else { //...

Making view transitions fast - do you use this hack?

I have an iPhone app that displays a modal view controller. The modal view controller shows two instances of a custom subclass of UITextView called RoundedTextView, an MKMapView, and a UIToolbar. I construct the viewController only once, and reset its data and present it each time the user summons it. When showing this view controller w...

Retain object through UIAlertView/UIActionView dialogs

I'm working on a local (to the method) custom object and need to display a dialog (UIActionSheet or UIAlertView) to the user. What's the best way to get access to same object when delegate is called after user interacts with the dialog? Any Cocoa tricks besides adding another instance variable to current class? ...

Distorted sound when using remote I/O AudioUnit

Consider aurioTouch sample application provided by Apple. I wanted to simulate a lengthy processing of the recorded audio and modified the sample by introducing a delay of 0.1 second in the render callback method: PerformThru. This leads to a distorted audio and static noise being played through iPhone's speaker or headphones. The noise ...

SOLVED: Peculiar problem - iphone application distribution build contains a bug

SOLVED: This has been solved following the assistance of many people. I'm now writing this, so that people with similar problems can benefit from it. In order for me to recreate this bug, I had to run the distribution build on my device. This was accomplished following MrMage's advice, which told me to change the certificate to the devel...

Iphone: How to update a table view that displays managed objects when new object is added.

I have a table view that displays managed objects (Tasks). I'd like to fetch all tasks and update the table view once a task is added or modified. Currently refresh the tasks array when NSManagedObjectContextDidSaveNotification is fired. But I'm afraid that this could be quite inefficient as the table is also updated when other objects ...

iPhone - NSDictionary to NSArray with preserved order

I've got a couple dictionaries in a property list, that make up a menu system for my game, like so: New game Easy Normal Hard Load game Recent Older Options Game Sound etc.. Each item in this list is a dictionary. I use UINavigationController and UITableViews to display this menu system. When an item is ch...

How to conform to UITabBarControllerDelegate

I have a tabbar based application and do the following to get a reference to the application delegate: MyAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; Which then gives this warning: warning: type 'id <UIApplicationDelegate>' does not conform to the 'UITabBarControllerDelegate' My application delegate hea...

Objective-C for iPhone - app crashing when using simple date commands

Hi everyone... I'm still learning Objective-C so forgive me if this is a simple amateur mistake, but I guess we all have to learn somehow. Basically I have an app with a simple bit of text, at the header of the screen, which has been IBOutletted and called 'headerText'. I want this to read "Summary for February", replacing February wit...

How to recognize Touch Up Inside gesture from UITouch

I am making a grid view. It subclasses tableview and lays out multiple subcells (columns) per cell. That's all working fine. Now, I need to detect when an individual sub-cell is tapped. I have overriden touchesEnded in the grid view. Is there a way I can take that NSSet of UITouch objects and detect whether it was a touch up inside or ...

cocoa touch: rand() returning the same string

Here's my code: -(void)randommoves { NSArray *possiblemoves =[NSArray arrayWithObjects:@"R ",@"R' ",@"L ",@"L' ",@"B ",@"B' ",@"F ",@"F' ",@"U ",@"U' ",@"D ",@"D' ", nil]; NSMutableString *finalmoves = [[NSMutableString alloc] init]; finalmoves = [NSMutableString stringWithCapacity:0]; [finalmoves retain]; int i = 0; for (i=0; i<20; i...

UIScrollView - Figuring out where the scroll will stop

I'm trying to figure out how to calculate where the scrollview will stop when a user does a swipe gesture and the scrollview goes into deceleration. I'm trying to use the delegate functions, but I can't accurately figure it out. Please help! - (void) scrollViewDidScroll:(UIScrollView *)scrollView; - (void) scrollViewWillBeginDeceleratin...

Resizing TableViewCell when TableView is in grouped mode

I have a TableView in my application and I've created a centered label inside TableViewCell that I'm placing in the view. When TableView is in standard mode everything is ok and the label is really centered. However when I change the mode to grouped then the label is displayed slightly to the right. I suspect this is because in grouped m...

Should I have a NSFetchedResultsController in every view?

I'm using Core Data in my first iPhone application and trying to understand NSFetchedResultsController. It works great in my root view. Do I need to instantiate an instance in every one of my view controllers? If so, is there a template that makes this as easy as it was in my root controller (I just checked a box in the template when cre...

How do I call methods in a view controller on the press of a button in it's parent view controller?

I have an iPhone app which has a tabBarController as the root view controller in mainwindow.xib. One of the tabs has a class of UINavigationController and its View is loaded from an external Nib file currently called secondView.xib How can I get a UIBarButtonItem which is on the NavigationController in the mainwindow.xib file to trig...

Creating a UIView in Interface Builder that automatically centers itself when added as a subview

I created a UIView xib in Interface Builder and tried everything I could to indicate that the UIView should center itself, anchor itself at center, orient itself in central coordinates, etc. etc. But whenever I add it as a subview in code, I also have to programmatically set its frame up with CGRectMake() or else it will always add to t...

Toubleshooting mapkit performance

I'm plotting over 500 points on a map using mapkit. Zooming is a little jittery compared to the native google map app. I've discovered what is causing the slowness. I'm adding custom annotations so that I can later add different pin colors and buttons for detail views: - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnota...

Disabling visible links in UIWebView

I have a number of web views in my app in which I need to be careful about allowing further HTML links. I disallow links in the delegate method shouldStartLoadWithRequest. This works fine, except for one thing. In the web view, the links are still highlighted in blue. So the user naturally thinks they are active links, but when select...

How to invoke TouchesBegan, TouchesMoved, TouchedEnded programmatically..

Is there a way to invoke TouchesBegan, TouchesMoved, TouchedEnded programmatically ?? ...