objective-c

How to properly set relationships in Core Data when using setValue and data already exists

Let's say I have two objects: Articles and Categories with a many-many relationship between the two. For the sake of this example all relevant categories have already been added to the data store. When looping through data that holds edits for articles, there is category relationship information that needs to be saved. I was planning on...

Can I access elements/methods named "button1" "button2" "button3" etc. using "buttoni" inside a for-loop?

I have a bunch of buttons named: button1 button2 button3 etc. Is there a way to basically do this? pseudocode for(int i = 1, i < 15, i++) { button{i}.selected = YES; } This also goes for method calls, etc. I've often thought such a way of calling methods would be very convenient, but I don't think I've ever seen it done when us...

Best way to figure out why didReceiveMemoryWarning is always getting called on a UIViewController

I have a UIViewController and I'm noticing that I've done something to where the didReceiveMemoryWarning method is getting called every time I run it on an actual device. I've run the project with Run > Run With Performance Tool > Object Allocations (and Leaks also). There are no leaks but I have no idea how to read or understand the "...

NSURLConnection not "firing" until UITableView scrolls..

Hi, I've got a UITableView that loads an image asynchronously and places it in the UITableViewCell once it's loaded (I'm using almost the exact same code as in the "LazyTableImages" tutorial). This works fine for all images when I scroll the table, but it's not loading the images that are first in the view. The code is definitely worki...

Problems in getting data from CFStreamCreatePairWithSocketToHost

Hi I'm building an iPhoe app with a socket to a PC app , I need to get an image from this PC app. It's my first time using "CFStreamCreatePairWithSocketToHost".After I establish the socket with "NSOperation" I call CFStreamClientContext streamContext = {0, self, NULL, NULL, NULL}; BOOL success = CFReadStreamSetClient(myReadStream, kMyNe...

how to get variable stored in another object using objective c

Hi All SaveNotes *saveNotes = [[SaveNotes alloc]initWithTitleString:title descrString:descr]; [titleDescrObjects addObject:saveNotes]; [saveNotes release]; from the above code i have saved title,descr to a class SaveNotes , and then i have stored that object in my NSMutableArray -> titleDescrObjects, Its working fine, i need to get p...

persistant '<class>' may not respond to +method

I've found a bunch of posts on this problem and have actually managed to removed one of the warnings i was getting from these however one persists. Some context: I'm creating currency converter as an exercise in learning Objective C My Rate class represents a rate that a currency can be converted to or from looks like this: Rate.h //...

MapKit custom annotations being added to map, but are not visible on the map

I have an interface with a mapView and UITableView. Data is loaded from a server, and the annotations are created and added to the map with [mapView addAnnotation:truck] the tableview is then populated using the array thats retured from [mapView annotations] once this process is completed, i check the number of annotations on the ...

UIActivityindicator won't be displayed upon Modalviewcontroller

Hey Guys, i've created a login screen via a modalviewcontroller. But certainly i have a problem to display a uiactivityindicator once the loginbutton was pressed. Instead the activityindicator seem to be displayed for a minimal period of time, when releasing the modalviewcontroller. Does anyone know the problem. Could anybody help me ou...

Custom class deallocated as soon as the app starts.

Heya, I've added a class object to the nib file. All connections are made. But for some reason, the object is deallocated as soon as it's created. Here's the code: control.h: #import <Foundation/Foundation.h> @interface control : NSObject { IBOutlet UILabel *PlayerScore; } -(IBAction) addPoint: sender; -(void) dealloc; @end c...

Why does Apple use Objective-C for iPhone development? (App Store)

I'm interested to know your opinion on why Apple uses a language such as Objective-C for app development. Does Apple's app store allow apps written only in this language? Does apple even look at your source-code or does it just care of the binary output? I learned that most of their app rejection (in the app store) is based upon apps cr...

how reference copy is handled in Objective-C?

Object graph [Instance A] tree / \ / \ / \ [Instance B] [Instance C] apple bug Question Instance A has to reference copies to Instance B and Instance C. If I retain or release Instance A, which has references to the other two instances, wha...

Invalid receiver type for NSInteger

(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { NSLog(@"bla %@", [section count]); return [possessions count]; } Does anyone know how to implement a simple NSLog because I am getting an error. ...

When a object can be released in the dealloc method in Objective-C?

Hi, What is the difference of releasing the object outside and inside a dealloc method? When it will be appropriate to specify release of the object in the dealloc method, pls can u specify the differences... ...

how to remove sub views.

Hi I have added UIButton,UITextView as subview to my view, programatically. notesDescriptionView = [[UIView alloc]initWithFrame:CGRectMake(0,0,320,460)]; notesDescriptionView.backgroundColor=[UIColor redColor]; [self.view addSubview:notesDescriptionView]; textView = [[UITextView alloc] initWithFrame:CGRectMake(0,0,320,420)]; [self.vi...

QTMovie Player Left and right speaker sound.

hey all I am using two QTMovie object for playing a two mp3 file. I want one mp3 file sound came from left speaker and another mp3 file sound come from in right speaker. Also i want how to manage left and right speaker sound. Please suggest,how can I do this. Thanks Mandeep ...

Interface Builder: Resize View From NIB

I have a custom UIViewController and a corresponding view in a nib file. The view is added to the UIWindow directly. [window addSubview:customViewController.view]; Sizes of the window and the view are default (480x320 and 460x320 correspondingly). When I create CustomViewController inside the nib file and check "Resize View From NIB"...

How to determine the current view bounds in split view of Ipad App?

Hello friends, I have tried following code to determine current view bounds in shouldAutoRotate.. fn UIViewController *temp1 = [appDelegate.splitViewController.viewControllers objectAtIndex:1]; float screenwidth = temp1.view.bounds.size.width; float screenheight = temp1.view.bounds.size.height; bt actually when u rotate from one m...

iPhone Objective-C Form Validation

Hello, I am an old developer but new to Objective-C and iPhone development. I am looking for the best way to do form validation for values entered. I have been googling for a while and can't find any good code, but might be using the wrong key worrds, etc... I am looking for things like catching for empty string, numeric validation, ...

Using enums and switch statements in a class

How would I make the following calculator Class work?: //Calculator.h #import <Cocoa/Cocoa.h> @interface Calculator : NSObject { float initialNumber, operandNumber; typedef enum{ additionOperation, subtractionOperation, multiplicationOperation, divisionOperation }operationType; } @property(readwrite) float...