objective-c

UISlider Multiple Touch Lag

I'm developing an game which has a component based on UISliders. The player must slide them from left to right one at a time, and on occasion two at a time. The problem lies in the double slides. When sliding two UISliders at a time, the sliders lag behind the player's touches, and often create noticeable lag in the game (this was tested...

Am I not understanding Obj-C at all? Why won't this NSLog message display?

main.m #import <Cocoa/Cocoa.h> int main(int argc, char *argv[]) { return NSApplicationMain(argc, (const char **) argv); } CoolClass.h #import <Cocoa/Cocoa.h> @interface CoolClass : NSObject <NSApplicationDelegate> { } - (void) applicationDidFinishLaunching : (NSNotification *) aNotification; @end CoolClass.m #import "CoolC...

Ascess the instance variable globally in objective c

I am new to iphone development.I want to access a variable declared in one view in another view.How can i achieve it.Whether it is possible by using extern variable, if so how to declare and implement it.Can i achieve it by using delegates?then so how to implement it.Please guide me.I am browsing google to get and idea to achieve it, i ...

How to assign object of one class to other in Objective-C?

Hello, how to assign object of interface to a protocol's object? i've a protocolA and protocolB. all the methods of both the protocols is implemented in MyClass.How to restrict the access to only protocolA's methid and protocolB's methods ?Coding is done in Objective-C for iPhone application. ...

releasing View Controller which are in Dictionary - in objective c

Hello ! Every on here. I was just confusing a little bit for the following issue. I have coding in my project as follow. I am adding view controllers' view to the each cell of table view. let me explain how... An array, like these NSMutableArray *arrTbl=[[NSMutableArray alloc] init]; NSMutableDictionary *dOne=[[NSMutableDictionary a...

Increasing object allocations, While checking object allocations in the Instruments

- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation { MKPinAnnotationView *annView = nil; annView=[[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currentloc"]autorelease]; for(int i=0;i<[List count];i++) { Small *Obj=[List objectAtIndex...

String truncated in Core-Data on iPhone

I have an Entity (Article) with an Class defined at xcdatamodel. In this class i defined an String NSString *test; currentArticle.test = string; String is more than 50 characters long. But when i try to fetch the Stored Object with: Article *article = [fetchedResultsController objectAtIndexPath:indexPath]; then article.test is tru...

how to use the camera roll feature which says upload video to youtube, email and mms, in our own iphone application???

Hi, i have built an iphone application which makes a video and than you can record the video further. now the main part or my application is that i want to upload it to youtube or e-mail it. now conventionally you take a video or picture for instance from the gallery and using the camera roll feature. can i utilize that feature in my own...

Declare at start, or as you go?

I would say this is pretty much a style / readability thing, although I do see nearly all objective-c/cocoa formatted as per "METHOD_002". I am just curious if "METHOD_001" would be considered bad style, there are advantages to having all the declarations at the top of a method, but then again there are disadvantages in terms of readabil...

Obj-C keeping memory addresses the same on next debug

Hi, I'm not sure if there is a name for this technique, but I remember doing something like this a long time ago in C++. I would like to breakpoint and observe a specific object of which there are hundreds in my program. It would be nice if you can tell the compiler to use a reserved space of memory so that I can run once, pull out a ...

Push/Present Modal View Controller

I have a table in my view controller (let's call it TVC1). I have rows in TVC1 that are used so the user can input some more data in addition to the data on TVC1. So, when someone taps a specific row in TVC1, it will show another view controller (let's call it TVC2). However, when TVC2 is shown, all of the data in TVC1 is cleared. How ca...

Adding Two Numbers Entered as Strings in Textfields

Hey Guys , I have two text fields in which numbers are inputed as strings. I need to convert the strings to numbers, add them together and then display the result in a 3rd textfield. I am totally new to iPhone programming .. So please don't be hard on me :P Ok here is the problem AdditionViewController.h #import <UIKit/UIKit.h> @i...

How to change only font size for the whole styled text in NSTextView

I need to set a text size (for example to 42) of the selected rich text which uses multiple fonts. I imagine I can check attributes of each group of characters, modify the font size and set attributes back, but looking at the floating Font panel it seems like there should be a very easy and straightforward way to accomplish that. Do I ...

Problem with parsing JSON result

Hello, I have a problem with parsing a JSON result. This is what I get from my HTTP request: {"subscriptions": [ {"id":"A", "title":"A title"}, {"id":"B", "title":"B title"}, ]} And this is what I'm doing in my code: // Getting the result<br> NSString *str = [[NSString alloc] initWithData:receivedData encoding:NSASCIIS...

Using accessor methods to set iVars?

Initially, I was looking at the way "pickerData" is set and thinking I wonder why you can't just assign it directly (as in METHOD_002), but then I stated thinking that I should really be using the accessor methods I defined and not setting the instance variables directly. Am I understand this correctly that METHOD_001 is a better way of ...

What is the best URL or book about memory management in Objective C?

I am trying to find good resource of book to learn more about memory management in Objective C. To be more exact I wonder when and how to use properly alloc, init, retain and/or copy on object, how it's managed, and released; besides what autorelease is and how to use it, when And why? how to handle this in simple methods to work with in...

Download video before view Iphone sdk

Hi, I am developing an application that requires to play some video. However I do not want to pack the videos with application. Instead I would like to download videos in the NSDocumentDirectory and then play from there using MPMoviePlayerController. Anybody any Idea how could I download the video from a url? Thanx, Gezim ...

Run a Bash script as root with Objective-C / Cocoa

Given that there is a file called copystuff in the Resources folder in a an xCode project, and that file reads: #!/bin/sh cp -R /Users/someuser/Documents /Users/admin/Desktop And if this bit of code below is linked to a button in IB ... it will copy the /Users/someuser/Documents directory to /Users/admin when the button is pressed in ...

Why cocoa dont use same enum declaration style everywhere ?

I was wondering what is the rationale behind different styles of enum declaration on cocoa? Like this: enum { constants.. }; typedef NSUInteger sometype; Is the reason to use typedef to get assigments to NSUInteger to work without casting? Sometimes the typedef is either of NSInteger/NSUInteger, why not use NSInteger always? Is th...

Taking decision on command line parameters in a cocoa applications

Hi there I have my Cocoa Application, which will be called with or without parameters in the command line. I would like to take decisions over the parameters received on the application, ie, if a special parameter is received I would like to trigger an action on it. Is there anyway for doing this?? Cheers ...