objective-c

Get all NSDates BETWEEN startDate and endDate.

Hey everybody, My question is the REVERSE of the typical "How do I find out if an NSDate is between startDate and endDate?" What I want to do is find ALL NSDATES (to the day, not hour or minute) that occur BETWEEN startDate and endDate. Inclusive of those dates would be preferable, although not necessary. Example: (I know that these d...

Help with a method that returns a value by running another object's method

I have a Class that runs the following method (a getter): // the interface @interface MyClass : NSObject{ NSNumber *myFloatValue; } - (double)myFloatValue; - (void)setMyFloatValue:(float)floatInput; @end // the implementation @implementation - (MyClass *)init{ if (self = [super init]){ myFloatValue = [[NSNumber alloc]...

Is CoreData typically used as the Model or is it an implementation detail of the Infrastructure?

I would like to use a Sqlite datbase in an iphone application. The example in the book I am reading has the controllers directly calling into CoreData objects. Coming from MVC/MVP in .NET to me this is akin to opening a SQL Connection in a button event handler. I would typically have a repository that handled the details of retrieving...

Objective-C: Point of releasing a View

Hello I made a static mainmenu with a TableView. Sometimes it crashes because my Subview has allready deallocated a subview. Is also ok to release a View in the dealloc mehtod of the local object instead of that: [NavController pushViewController:self.AnotherView animated:YES]; [self.AnotherView release]; //This line into (void)viewDi...

UINavigationItem titleView position

I'm using UINavigationItem's titleView property to set a custom UILabel with my desired font size/color. Here's my code: self.headerLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, 400.0, 44.0)]; self.headerLabel.textAlignment = UITextAlignmentCenter; self.headerLabel.backgroundColor = [UIColor clearColor]; self.headerLabel.f...

Jittery scroll performance in UITableView after iOS 4 upgrade

I have some large images in a grouped UITableView. There's 1 row in each section which holds the image and there is associated header and footer text for each section about the image. I worked hard to get it to scroll smoothly is iPhone OS 3.x and finally succeeded. But... when I upgraded to iOS 4, that all changed. Now there is very jer...

Accessing NSManagedObject fields with KVC/valueForKey vs properties - which is better?

Writing my first app with CoreData. The book I'm using to guide me has code like this: // 'Person' is my managed object class Person *newPerson = [NSEntityDescription insertNewObjectForEntityForName:@"Person" inManagedObjectContext:self.managedObjectContext]; [newPerson setValue:nameField.text forKey:@"name"]; The book says that...

Circle and Sphere in OpenGL ES

In OpenGL ES 1.1 (using Objective-C), what is the easiest way to create a circle, and for a sphere? I would prefer for it to be easy to implement, as I am new to OpenGL. Thanks jrtc27 ...

How to pass password to decode LZMA (7zip) encrypted archive in C / Objective-C ?

Does anyone know how to pass password to decode function in LZMA SDK? ...

Question about regular expression evaluation using RegexKitLite

I am trying to get all css link from html like this segment of code: <link href="http://media.ticketmaster.com/en-us/css/1c84b57773d8f594407f0b0b78d67aba/tm/default.css" rel="stylesheet" type="text/css" /> <link type="text/css" rel="stylesheet" href="http://media.ticketmaster.com/en-us/css/1c84b57773d8f594407f0b0b78d67aba/tm/datepicker....

iphone select control

Is the select control available as an API? when you select text you are presented with cut/copy..options I would like to add another one. is it possible if so how? ...

How does iBooks implements its highlight text feature?

I would like to do something similar for an HTML document or PDF. How should I go about implementing this feature? ...

CGContext text drawing doesn't scale up on iPhone 4

I am trying to create an app that scales up nicely on the iPhone 4. Currently most of it scales up perfectly, except for one crucial piece: the text that I draw inside a CALayer, inside its drawInContext: method. Here is my code: - (void)drawInContext:(CGContextRef)context { UIGraphicsPushContext(context); CGContextSetGrayFill...

CI Filter to create Black & White image?

I have a CIImage I need to convert from color to Black and White within my Cocoa / objective C program. Peter H. previously pointed me to this link (http://www.codingadventures.com/2008/06/threshold-filter-in-glsl/) as a potential solution ... but I am having trouble compiling the kernel routine there (see separate thread, if interested...

isMemberOfClass vs comparing classes with ==

Is there any real difference between: id value; BOOL compare1 = [value isMemberOfClass:[SomeClass class]]; BOOL compare2 = [value class] == [SomeClass class]; to check if value is a SomeClass object? ...

GKSession won't send data to peers on second connection

I've got a peer to peer iPhone game working pretty well. I've created a table to display available peers and I can connect (so far) up to four devices and play a full round of a game from start to finish: But here's my problem... I create a GKSession on one device with GKSessionModeClient and the other with GKSessionModeServer. The c...

Sharing single class in all of ViewControllers and Views

I have 4-5 screen. created using UIViewControllers and many UIViews inside these viewcontrollers. I have a single class Properties. Every UIViewController and UIView needs it. Currently i am passing Properties into views and subviews and then back to parent views and so on. Is there any better option? Just initializing Properties at on...

Passing UIColor to a method and app crashing

see code, interface @interface ColorPreview : UIView { UIColor *backgroundColor; } @property (retain) UIColor *backgroundColor; -(void) reDrawPreviewWith:(UIColor *)bgColor; @end implementation @implementation ColorPreview @synthesize backgroundColor; - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:fr...

viewDidLoad & viewWillAppear conspiracy

I have a favorites plist file when I try to load it like this - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; NSString *path = [[NSBundle mainBundle] pathForResource:@"favorites" ofType:@"plist"]; NSMutableArray *array = [[NSMutableArray alloc] initWithContentsOfFile:path]; self.allFavorites = array; [array r...

What is a pool in in Foundation Kit?

Every time I write a new iPhone Application, I start with creating the Target, adding the frameworks, and writing this in a brand new main.m: NSAutoReleasePool *pool = [[NSAutoReleasePool alloc] init]; // etc... What is actually such a pool? What is it for? It surely doesn't protect the device when it falls in a swimming pool. But why...