objective-c

Label text not initialising in new view iphone

DetailViewController.m Code: - (void)viewDidLoad { [super viewDidLoad]; NSString *navTitle = self.navigationItem.title; NSString *stalklabel = self.labelforurl.text; NSLog(@"%@", stalklabel); NSURL *address = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.twostepmedia.co.uk/json.php?q=%@",stalklabel...

Where's +alloc defined?

Hi all, This may be a silly question. I need to know where is the +alloc method is defined for any Objective-C class? If it is a class method in NSObject how it is inherited? Because class methods cant be inherited. Thanks. ...

What is the 'garbage value' in 'Left operand of '/' is a garbage value' warning generated by "Build & Analyze"?

When I 'Build and Analyze" this code in Xcode, I get a warning that I don't understand. Here's the method with the problem: -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch * touch = [touches anyObject]; CGPoint location = [touch locationInView:self]; CGPoint relativePosition = CGPointMake...

How to customize ShareKit actionsheet?

I am using ShareKit (www.getsharekit.com) to share my URL's to Twitter and Facebook. I want to be able to remove all of the additional social network it points to, but am not sure where to edit? ...

Editing a model in Apple's Settings style

Hi there, I woud like to implement some editing mechanism for an iPhone application, that is I want the user to be able to edit an instance of my model. The model contains two types of data: The first is just an NSString where the user can write virtually anything he likes. The second one is a selection where he is able to pick one from...

Subclassing of NSMutableArray

Hi! In Cocoa Fundametals I found following code: @interface ValidatingArray : NSMutableArray { NSMutableArray *embeddedArray; } @end @implementation ValidatingArray - init { self = [super init]; if (self) { embeddedArray = [[NSMutableArray allocWithZone:[self zone]] init]; return self; } @end But I don't understand this l...

Limiting number of simultaneous sounds in CocosDenshion/Cocos2D

Hi, I'm building a game which will play a handfull of sounds all the time (rockets, rocket impacts etc). After a mere moment this turns into a real mess and i figured i need to limit the number of sounds. Problem is i don't want to decrease the number of channels of something because then one type of sound could "hog" the channels and ot...

What to do in a separate thread?

So I've read some stuff about multithreading and NSOperation and wondering how I can use that to improve my app. Using Instruments I have isolated a few places where my app could definitely use a speed improvement. My question is, are these kinds of things suitable for another thread using NSOperation? Drawing a view: I have a rather co...

iOS SDK broken ever after reinstall UIKit and Foundation frameworks not found.

For the pch file I get these errors: /Users/matt/Programming/iPhone Monkey Curling lite/iPhone_Monkey_Curling_Prefix.pch:6:34: error: Foundation/Foundation.h: No such file or directory /Users/matt/Programming/iPhone Monkey Curling lite/iPhone_Monkey_Curling_Prefix.pch:7:24: error: UIKit/UIKit.h: No such file or directory Here's the fi...

Scope of an object, objective-c, CLLocationManager

I'm still pretty new to programming so I have somewhat of a noob question. When you have an instance variable, in my case of type CLLocationManager, in my appDelegate.m file, I thought I could allocate and initialize my CLLocationManager instance variable in the applicationDidFinishLaunching method. And then I could use a button to sta...

Objective-C (iPhone) ivars and memory management

I am subclassing NSURLConnection, and used MGTwitterEngine as a base to help me get started. That may be irrelevant. However, I noticed in their code they don't use @property or @synthesize for their ivars. They have wrapped the ivars in accessor methods which look like this: - (NSString *)identifier { return [[_identifier retain] aut...

Write iPhone requirements specification?

What do you use to draw iPhone ui and write iPhone requirements specification? ...

I want to learn Objective-c, but...

...I am not sure which book to go with. I came to conclusion and it's between those two: [Programming in Objective-C 2.0] vs. [Learn Objective-C on the Mac]. My programming experience/skill is fairly strict, as I just know a little C. I know some loops (if, if-else, while, for, do, case) and how algorithm work. That's pretty much it, I...

ivars when mixing C and Objective-C

I'm writing an Objective-C wrapper for a C library and having problems accessing the references of my ivars. The C library requires that I specify a function pointer that handles events, I specify it during the initialization of my Objective-C class. - (id) init { [super init]; RegisterClient( return self; } The C librar...

Detect long press on UIWebview and pop up a menu if I'm pressing on a link

Hi guys, Running into a problem with UIWebview, it doesn't seem to react to gesture recognizer. I would like to get a popover to appear whenever I do a long press on a link (or image) with different actions. Any help would be greatly appreciated =). Thanks. ...

How to fetch one to many relationship in core data?

Hi, Let say the data entities are: Bookshop <--->> Books How do I fetch all books belonging to a specific book shop that contain "cloud" in the name for example? The following method feel clunky. Bookshop *bookshop = (Bookshop *) nsManagedObjectFromOwner; NSString *searchTerm = @"cloud"; NSFetchRequest *fetchRequest = [[NSFetchReque...

Using a Spotlight search result to open an application in a specific state

I have an application that will play a series of radio stations by choosing them from a drop down menu. Ideally I'd like to add some code, so that a spotlight search that would return any of the items in the dropdown and open the application as if you did this from within the application itself. The spotlight documentation gives no clue...

MPVolumeView appearing in other cells.

Hi, i am using the code below to implement a volume view into a cell. [[cell detailTextLabel] setText: @""]; MPVolumeView *systemVolumeSlider = [[MPVolumeView alloc] initWithFrame: CGRectMake(100, 10, 200, 100)]; [cell addSubview: systemVolumeSlider]; [self.view addSubview:cell]; [systemVolumeSlider release]; //[MPVolumeView r...

Objective-C empty array performance

I have an application that iterates over an array every step and I seem to be getting surprisingly slow results when the array is empty. So, I investigated with some follow-up tests that went something like this: NSMutableArray* ar = [NSMutableArray array]; double time = CFAbsoluteTimeGetCurrent(); for (int i = 0; i < 10000; i++) { ...

Get objects in custom UIView objective c

I have a custom UIView which I named UIWheel that I am rotating upon TouchDown. This UIWheel has many UIViews which I would like to rotate at the opposite direction (so that they remain appearing upright even after rotation) . How do I code to tell it to get all of the UIViews in the UIWheel and in TouchDown rotate in the opposite direc...