objective-c

Popping View crashes Application at [super dealloc]

I have a tableView:didSelectRowAtIndexPath: where I create a ViewController-Instance each time an item is selected. Sometimes it works fine for a long time, sometimes it crashes with a EXC_BAD_ACCESS very quickly. The debugger blames the line [super dealloc]; in the QuestionDetailViewController. Why? I log the QuestionDetailViewControll...

How to disable UIWebview horizontal scrolling?

I've tried disabling it by inserting: <meta name="viewport" content="width=320" /> into my HTML string, and a dozen variations of the above in the vain hope that I just screwed up the tag syntax... but nothing seems to stop UIWebView from scrolling horizontally. And yet there are apps that manage to do this (like MobileRSS), and presu...

Using UITouch inside a UIScrollView

Hi all, Just toying with the SDK and I was wondering if possible a UITouch event can work inside a UIScrollView. I have setup a UIScrollView which handles a large UIView, inside the UIView is a UIImageView, I've managed to get the UITouch to drag the UIImageView outside of the UIScrollView but inside it's not registering the event. I ...

Is it valid to ignore an return value of an method in objective-c?

For example, when I call a method that returns an value, but I'm not interested in this at all, can I safely ignore that? Example, instead of: CGSize size = [str sizeWithFont:myFont minFontSize:19.0f actualFontSize:&actualFontSize forWidth:150.0f lineBreakMode:UILineBreakModeClip]; ...do this: [str sizeWithFont:myFont minFontSize:19...

Problems with empty table view

Hi, im trying to write an app that will display a list off lines from a book e.g line 1, line 2 in a table view and you can then select a line to view the corrosponding text. I've got to the stage where the text should at least appear in the table view(not as far as being able to select it), yet it remains empty. I used the debugger a...

When should I extend NSDocument and when should I extend NSWindowController?

I've an application that holds a main window with a list of items, and from that window an undetermined number of windows can be opened. Each of those windows can hold several instances of a model object, with those instances listed in a drawer. I started my project by making the (main window) list of items extend NSDocument and each ot...

get iphone window background color

I've been looking at the Stanford University iphone videos on iTunes U. And saw the teacher trying to do something similar to this code but he realised and said it didn't work though I didn't get why: - (IBAction)flashPressed{ if (window.backgroundColor == [UIColor magentaColor]){ window.backgroundColor = [UIColor redColor]; }else { ...

Overriding NSDocument's fileWrapperOfType causes "Document could not be saved."

I've got to be missing something simple, but Google is not helping. My file saves and loads fine. (I've overridden dataOfType to get some stuff in it.) Then I override fileWrapperOfType (in preparation for creating a bundle), and I get a "The document 'Untitled' could not be saved as 'test'." sheet when I try to save. Even when I empty ...

How to get the same UITableViewCell layout as in the Address Book app?

Hi, I currently have a custom UITableViewCell which contains a few labels, and an image. The "main" label is used to display people's names. Currently, I'm styling it in bold text. What I'd like to do (to gain some space and readability), is to mimic the Address Book app cell style, that is: first name in light text, and family name in ...

Sorting NSTableColumn contents

Hey, I have a problem with sorting NSTableColumn contents. In my NSTableView there are three columns: File, Size, Path. The contents are stored in NSMutableArray. Each object in this array is a NSDictionary containing three keys: file, size and path - value for each is a NSString. In Interface Builder, in each Table Column's attribute...

Access custom cell within - (void)tableView:commitEditingStyle:forRowAtIndexPath:

Hey Guys, does anybody know how i can access a custom cell within the - (void)tableView:commitEditingStyle:forRowAtIndexPath:. I need access to my Custom Cell Class to retrieve some parameters. Thanks. ...

Saving a "project"-type document (containing sub-documents)

I'm trying to create a "project"-like document, in that it contains subdocuments in a specified directory. I'd like a brand new save of a document to set up that directory with appropriate subdirectories. I'd like a "Save As" to copy all those subdirectories and any files within them to the new location. But I'd like a "Save" to only upd...

How to save video from a url to disk, also how to begin playback after some buffering?

First question is, given a url to an mp4 video, how can I save that file to disk? The followup to that is while its saving, can I begin playback after its buffered some of the video to disk or do I have to wait for the entire file to be written and then: MPMoviePlayerController* theMovie=[[MPMoviePlayerController alloc] initWithContent...

"-[CFNumber intValue]: message sent to deallocated instance" and no idea

Hey there, i have a problem with a exc bad access. I already turned in NSZombieEnabled, but cannot figure out why this problem will be caused. How the cartInstance Array is defined you can see below in the following function. It's a NSMutableArray with several NSMutableDictionaries The error occurs every time my counter i reaches 13. The...

Objective-c - How to serialize audio file into small packets that can be played?

Hi there, So, I would like to get a sound file and convert it in packets, and send it to another computer. I would like that the other computer be able to play the packets as they arrive. I am using AVAudioPlayer to try to play this packets, but I couldn't find a proper way to serialize the data on the peer1 that the peer2 can play. T...

NSMutableArray not working properly...(count shouldn't be returning zero!)

NSMutableArray count is returning zero after adding objects to it, its been an hour of hacking away trying to figure out why, and I'm still stuck, so that brings me here. Any ideas based off the following code, what the problem is? the object 'search' is a custom class defined in the header set as a pointer, with retain, nonatomic attr...

Back button title not receiving previous view controller's title

I am pushing 2 view controllers in to navigation stack in ApplicationDidFinishLaunching. [navigationController pushViewController:favorites animated:NO]; [navigationController pushViewController:root animated:NO]; The app loads fine, but on the start screen, the back button title is simply "Back". I do have a title for the FavoritesVi...

".objc_class_name_CUIFramework",referenced from:

hello, I'm working with developing an application for iPhone in Objective-C Can anyone tel me how to solve this error: ".obj_class_name_CUIFramework", referenced from: collect2:ld returned 1 exit status literal-pointer@_OBJC@_cls_refs@CUIFramework in MF_CoreAppDelegate.o symbol(s) not found I tried to compile my code, i don't have i...

Why does my NSDateFormatter return nil when parsing?

my code is like this NSString *tempDate = [NSString stringWithString:tempReviewData.pubDate]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateStyle:NSDateFormatterLongStyle]; [dateFormatter setTimeStyle:NSDateFormatterNoStyle]; [dateFormatter setDateFormat:@"HH:mm a"]; NSDate *newDate = [dateForm...

Animation or Video instead of Default.png (Iphone app)

hi, I saw in many application like Zara, Zara Home, D&G.. that instead of using the Default.png image for loading the application, they use a video instead. Did someone know how to do it? Did they manage to replace the Default image and put an animation instead or just load an animation in the ApplicationDidFinishLaunching Thanks, ...