objective-c

Giving another object a NSManagedObject

Alright, so I'm running into an issue with my code. What I have done is subclassed UIButton so I can give it some more infomormation that pertain to my code. I have been able to create the buttons and they work great. Capiche. However, one of the things I want my subclass to hold is a reference to a NSMangedObject. I have this code ...

Can you append a NSMutableArray to a file?

Hi. I am trying to write some data from an NSMutableArray to a plist, while keep the old plists content. The function writeToFile:atomically: overwrites the old contents with the new, I want to append the objects in the new array to the plist. How can this be done? Thank you. How can you check for duplicates while doing this? ...

Memory management & viewDidUnload?

If I have a viewController setup as below: @interface MapViewController : UIViewController <MKMapViewDelegate, CLLocationManagerDelegate> { CLLocationManager *locationManager; } -(void)viewDidLoad { [super viewDidLoad]; locationManager = [[CLLocationManager alloc] init]; } when it comes to memory management should I be ad...

How can I link in both remote and local assets into a webview?

I'm loading HTML-formatted content into my app from a web service, then plugging that into a local HTML template that lives within the app. Now, I need to set the UIWebView's BaseURL to point at the remote server so that all relative image links will load. However, I'm also trying to link in some local assets (CSS, JavaScript). Thus far,...

Setting the map as hybrid has no effect?

Does anyone know why setting the map as hybrid has no effect. Setting it as standard and satellite works fine though? . . . [segmentedControl addTarget:self action:@selector(handleSegmentClick:) forControlEvents:UIControlEventValueChanged]; [window makeKeyAndVisible]; return YES; } - (void)handleSegmentClick:(id)sender { ...

[super init] and loading NIB / XIB files?

I am a little curious, I have a view controller class and an NIB/XIB (both are named "MapViewController") If I do the following it loads the NIB with the matching name. -(id)init { self = [super initWithNibName:@"MapViewController" bundle:nil]; if(self) { do things ... } return self; } if on the other hand I ju...

Create object from NSString of class name in Objective-C

I was wondering if i could create a object of some class if i have the name of the class in a NSString. I know this is possible in other languages like ActionScript, C# and PHP... Something like this: NSString *className = @"AwesomeViewController"; UIViewController *object = [[className alloc] initWithNibName:className bundle:nil]; ...

Remove UIViewController from UIScrollView?

Hi, i add different View with (setPageID) to a ScrollView, but know i get a Memory problem on rotaion and i want to remove the actualy not showed view... how can i do this or how can i remove the memory problem? Thanks!!! - (void)setPageID:(int)page { if (page < 0) return; if (page >= self.listOfItems.count) ret...

iPhone Objective C - error: pointer value used where a floating point value was expected

I do not understand why i am getting this error. Here is the related code: Photo.h #import <CoreData/CoreData.h> @class Person; @interface Photo : NSManagedObject { } @property (nonatomic, retain) NSData * imageData; @property (nonatomic, retain) NSNumber * Latitude; @property (nonatomic, retain) NSString * ImageName; @property (...

Touch draw in Quatz 2D/Core Graphics

Hello, I'm trying to implement "hand draw tool". At the moment algorythm looks like that (I don't insert any code because methods are quite big, will try to explain an idea): Drawing In touchesStarted: method I create NSMutableArray *pointsArray and add point into it. Call setNeedsDisplay: method. In touchesMoved: method I calculate ...

Problem adding UITableViewCell manually

I am trying to add a UITableViewCell at the very bottom of my UITableView programatically. I am getting an index out of bounds error, which I am not sure how to resolve: - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return [items count]+1; ...

How to step inside NSManagedObject; access individual attributes.

NSManagedObject *entryObj = [self.fetchedResultsController objectAtIndexPath:indexPath]; entryObj consists of four String attributes. If I NSLog entryObj, I get the information I want. I cannot figure out how to access each of these properties individually. I read a similar post where the solution was to call ...

Using iPhone Core Data to many Relationship

When I define a to many relationship between entities in Xcode and then generate the data class from the entity I get a header with the following methods defined: @interface PriceList (CoreDataGeneratedAccessors) - (void)addItemsObject:(PriceListItem *)value; - (void)removeItemsObject:(PriceListItem *)value; - (void)addItems:(NSSet *)va...

How can I truncate an NSString to a set length?

I searched, but surprisingly couldn't find an answer. I have a long NSString that I want to shorten. I want the maximum length to be around 20 characters. I read somewhere that the best solution is to use substringWithRange. Is this the best way to truncate a string? NSRange stringRange = {0,20}; NSString *myString = @"This is a strin...

real-time broadcast audio

hello! if I can in real-time broadcast audio from a microphone headphone iphone.. I need to broadcast a slightly modified EQ sound into headphones. How can i do it?? ...

UIImage from NSDocumentDirectory leaking memory

Hey. I currently have this code: UIImage *image = [[UIImage alloc] initWithContentsOfFile:[imagesPath stringByAppendingPathComponent:[NSString stringWithFormat:@"/%@.png", [postsArrayID objectAtIndex:indexPath.row]]]]; It's loading in an image to set in a UITableViewCell. This obviously leaks a lot of memory (I do release it, two lin...

Links in UINavigationController

What is the class type used to create items that look like HTML links in iPhone apps? Is it just a label with formatted text? How is the selection detected? I am looking to have a Navigation Controller and have some text links on the root page. The user can then select any of the links, and the controller will go to the page for that...

Is it possible to add a custom image in the info pane in mapkit?

I am trying to add a custom image for the info pane in google map once a user clicks on a marker. I can't find anything in the MKAnnotation class. Any help would be appreciated. ...

Checking if an object has been released before sending a message to it

I've only recently noticed a crash in one of my apps when an object tried to message its delegate and the delegate had already been released. At the moment, just before calling any delegate methods, I run this check: if (delegate && [delegate respondsToSelector:...]){ [delegate ...]; } But obviously this doesn't account for if the...

Is it possible to send OSC commands to an iPad via the Camera Connection Kit?

I'm building a small controller device that I'd like to partner with a computer. I've settled on using OSC out from my custom built hardware and am pretty satisfied with what I can get from WOscLib. Two goals I'd like to achieve are portability and a very nice ratio between battery:computing power, and this has lured me towards using iPh...