objective-c

image size to completely take the navigationItem.titleview

Hello all, I seem to be having some problems with getting my image to completely cover the navigationbar( navigationItem.titleview). I already tried some things. I just want to have my image completely over the navigationItem.TitleView; I tried to make a CGRect and initialize my UIImage in it but to no avail. i figured this would ...

How to deal with forward declaration / #import in Cocoa Touch (Objective-C cross C++) correctly?

I am trying to write this header file: //@class AQPlayer; //#import "AQPlayer.h" @interface AQ_PWN_iPhoneViewController : UIViewController { AQPlayer* player; } @end AQPlayer is a .mm file written in C++. I tried to make a class forward declaration here, but it complains to me: error: cannot find interface declaration for '...

creating a stop button for MPMovieplayercontroller in a different file( overlay )

Hello all, i have an MPMOvieplayercontroller in my rootviewcontroller and have attached an action to it. it looks a bit like this. RootViewController.m -(void)playMovie1 { NSURL *movie = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"movie4" ofType:@"m4v"]]; MPMoviePlayerController * theMovie = [[MPMoviePlayerCo...

Best way to implement multiple levels within Objective-C roguelike?

I'm working on a roguelike using Objective-C/Cocoa to learn more. I've gotten most of the basic functionality out of the way, but I still have one problem I've been trying to figure out. Here's a breakdown of the process: First, the map is loaded: NSString* mapPath = [[NSBundle mainBundle] pathForResource:mapFileName ofType:mapFileTy...

Writing an NSPredicate that returns true if condition is not met

Hi, I currently have the following piece of code NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF contains '-'"]; [resultsArray filterUsingPredicate:pred]; This returns an array with the elements which contain '-'. I want to do the inverse of this so all elements not containing '-' are returned. Is this possible? I've tr...

iPhone Obj-C error: assignment of read-only variable 'prop.149' in Xcode

I'm programming an iPhone app using Objective-C. Here's the error Xcode gives me: error: assignment of read-only variable 'prop.149' The code: // Create CATransition object CATransition *transition = [CATransition animation]; // Animate over 3/4 of a second transition.duration = 0.75; // using the ease in/out timing function transit...

Objective C Threading Question

Here's the code: for(int i = 0; i < personListViewController.peopleCount; i++) { [NSThread detachNewThreadSelector:@selector(getPerson:) toTarget:self withObject:i]; } getPerson looks like this: - (void)getPerson:(int)whichPerson { } When I build this, I get the following :warning: passing argument 3 of 'detachNewThreadSelector:t...

Numeric keyboard with decimal separator

How can I get the numeric keyboard with the decimal separator? Currently I am stuck with UIKeyboardNumberPad. ...

UserDefaults in system preference pane installed for multiple users in OSX...

Hi I have a background-only app that is controlled via a preference pane in the system preferences. To communicate between pref pane and app I use distributed notifications. User defaults are shared via [NSUserDefaults addSuiteNamed:]. This all works out very well. The problem occurs when the user installs the pref pane "for all users"...

Cocoa Touch: Accessor method + memory needs clarification

Please consider a problem constructing an array and returning it to a parent object. Please have a look at my code and comments below. My question is: Why does method THREE work while methods ONE and TWO do not? // **************************** // Master.m // **************************** // Simply declare array and call accessor NSMut...

This loop chokes on 50,000 lines on the iPhone... can I improve it so it doesn't?

FILE *file = fopen([gpsFilePath UTF8String], "r"); char c[1024]; while(fgets(c, 1024, file)!=NULL) { NSString *cString = [[NSString alloc] initWithCString:c encoding:NSMacOSRomanStringEncoding]; NSArray *split = [cString componentsSeparatedByString:@","]; if ([split count] !=...

Purpose of methods that only call super?

In Xcode, a lot of the auto-generated class files (especially those for UIViewController subclasses) will include methods that resemble the following: - (void)dealloc { [super dealloc] } To me, this seems fairly pointless - if all a method is going to do is call super, why have it at all? Is there a purpose to these methods being g...

How to delete a row of a Table in iPhone.

Hi, I have a UITableView and I want to provide the functionality to user to delete the row when he slips or flicks his finger on the row. I know the editing style which provides a circular red button with -ve sign on it. But How to implement the flicking style. I saw many applications using it, so does apple provide any inbuilt delegate...

Best way to clear a UITextField

For an IBOutlet UITextField, does it matter as far as memory management or other reasons how you clear the text value? textFieldX.text = nil or textFieldX.text = @""; In objective-c it is acceptable to message a nil object and @"" is a static NSString *. I'm not sure if every @"" points to the same object in memory or if it allocat...

objective-C string encoding problem...

Ok, I'm fairly new to C sockets but I just need to do some simple sendto() and recvfrom() calls to get a string out across a network, using multicast sockets. After looking around and reading several guides (including Beej's), I found the code below which does the job of listening for messages sent over a multicast socket (which is what ...

How to serialize a UIView? (iphone)

Hi everyone, Is it possible to serialize a UIView object? If yes how can I do that? Thanks ...

Can you manually implement Cocoa bindings?

I've had a crack at implementing bindings for my own NSView subclass. It works, but there are problems with retain cycles when binding to File's Owner from a nib file. After reading into it a little, I discovered that Apple had the same problem a few years back but have fixed it with some magic undocumented class (NSAutounbinder). There...

How to make the text entry and keyboard active when loading a UISearchDisplayController

I have a UITableViewController which implements UISearchDisplayDelegate and UISearchBarDelegate when I load i would like the text entry to be active and the keyboard displayed so the user can begin typing immediately. I tried [self.searchDisplayController setActive:YES]; in the viewDidLoad method. The field becomes active and the ca...

How do I recreate a "settings application"-like tableview inside my application?

I want to add a view to my application that allows the user to change several (many) settings. It should look like the built in "Settings Application" (see here) but it has to be within my app itself. At the moment I just have a tableview and I manually add different cell objects (corresponding to switches, sliders, etc). Is there a smar...

How can I retrieve the HTML to be loaded into a WebView (or WebFrame) from a local persistent store?

So, I have a bunch of HTML is being stored in a SQLite database, and they link back and forth amongst themselves. When a user clicks to follow a link, that request needs to be serviced by pulling the appropriate HTML out of the database. This could result in needing to load images, which are also being stored in the database (this is a f...