objective-c

iPad UI element question

what UI elements to I need to create a boxed section like the related section on this page with a 3px wide border and a light grey background? UILabels and what else? are UILabels clickable? ...

How do I link a UIButton to my data object? (iPhone / Objective C)

I'm new to iPhone dev. My app is dynamically creating buttons, following from my data model. The model isn't just a simple list; it's a tree. I need some way to correlate a created button to that data model, so that when the button is clicked I know what part of the model it corresponds to. On Windows, most UI controls have a "tag" fiel...

objective c loops

How can I loop right in the middle of objective c? For example in the .m file: #import "untitled.h" @implementation untitled - (IBAction) runSample:(id)sender { (this is running when the button is pressed) } (Something here that just constantly repeat that won't mess anything else up) @end Any ideas?? Elijah ...

What's wrong with my Objective-C?

Something's wrong with my code here and I can't quite figure it out. Edit: Please correct this code. Thanks! int stringLength = [theData length]; for (int i = 1; i <= stringLength; i++) { unichar currentCharacter = [theData characterAtIndex:i]; int currentCharacterCode = keyCodeForKeyString(currentCharacter); ...

Objective c ERROR: incompatible types for argument 2 of 'NSRunAlertPanel'

Here is the code: float charlieSoundVolume; charlieSoundVolume = [charlieSoundLevel floatValue]; NSRunAlertPanel(@"CHARLIE",charlieSoundVolume, @"", @"", @"Ok"); This gives me the error: incompatible types for argument 2 of 'NSRunAlertPanel' Will NSRunAlertPanel not accept floats? Any ideas?? Elijah ...

textDidEndEditing: Objective c example

So I know you have to put this in the .h file: - (void)textDidEndEditing:(NSNotification *)aNotification BUT what do I call in the .m file?? How do I show that text is done editing in one of several NSTextFields? I looked around on the internet, but it seems pretty vague on how to use it correctly. Any ideas? Elijah ...

Objective c checking whether text field is empty

Here's the code: - (IBAction) charlieImputText:(id)sender { //getting value from text field when entered charlieImputSelf = [sender stringValue]; if (charlieImputSelf != @"") { (send field if not empty) } } This sends it even when the field is empty; therefore, this does not work as I want it to. Sorry...

Strange iPad screen issue - moving between views pushed controls up?

I am having a strange problem when I switch views using the UIView begin, set and commit animations. For some reason when I change the views it is pushing the elements that I have on the screen up by about 10 pixels? For example, when I load my first view the elements on the screen load correctly, but as soon as I move to another view ...

problem using MPMovieController in iPhone SDK 4.0

I was using MPMoviePlayer to play a short video in my app with no problems in SDK 3.1.3. I made the changes to the code in SDK 4 but the video is not playing. I just get a black screen and audio. The Apple Dev Center doesnt have any sample code for this class for the latest SDK. Following is the code I'm using: (void)viewDidLoad { [su...

How to change the row height for only the last cell in a tableview?

Hi Guys, In my table view I had more than 200 rows and Im managing then by keeping loadmoreresults in last cell to display only 40 rows per page.when the user clicks on the load more results 40 more cells is displayed.I changed the row height of loadmoreresults cell as different from other. The problem is when there is no more results t...

When you select Cell, UITableViewCell to change the size of the Cell.

I want to change the size of the selected cell. But, they shift position of the touch cell. - (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *currentCell = [aTableView cellForRowAtIndexPath:indexPath]; CGContextRef context = UIGraphicsGetCurrentContext(); [UIView begin...

Calling MainViewController method from subview

I have added a subview in my MainViewController. How can i call a method of my MainViewController from my subview? ...

How can I set font style as navigation buttons for uibutton lable in Objective-c?

Hi Guys, i am setting the Left bar button to the navigation bar. So I need same font as default bar buttons have. backButton = [[UIButton alloc] initWithFrame:CGRectMake(5, 5, 100, 30)]; [backButton setBackgroundImage:[UIImage imageNamed:@"backbutton_100.png"] forState:UIControlStateNormal]; [backButton addTarget:self action:@selector...

NSInvalidArgumentException

I'm working through "iPhone Development: The Big Nerd Ranch Guide". The project is "Random Possessions". I am faithfully following the code in the book and it compiles OK but I get this exception when running it: 2010-07-04 11:43:48.511 RandomPosessions[14828:a0f] -[Posession initWithPosessionName:valueInDollars:serialNumber:]: unrec...

UIImagePickerController seems to be "broken" in 4.0. Anyone else?

Been working on a 3.1.3 application and recently upgraded to the 4.0 SDK. I'm still building with a Base SDK of 3.1.3 and testing on a 3.1.3 device as well as a device running 4. On 4.0 device, when a UIImagePickerController is displayed I get the following messages: Using two-stage rotation animation. To use the smoother single-stage a...

Objective C: Access of primitive data type

I want to access primitive data types like int, Bool in Objective C. I have created one class in which I declared an integer varriable. Now in other class i want to access this data and also set the value of it. As in Objective C setter methods are applicable only for objects and I can't convert int to object. So how would I be able to...

How can I return from one scene to another on Cocos2D

Hello everyone, I'm trying to play a "cut scene" with cocos2d. I use: [[CCDirector sharedDirector] replaceScene:[CCCrossFadeTransition transitionWithDuration:0.2 scene:[s node]]]; to play the new scene. However, i want to return to the previous screen when i'm done playing this cut scene. Can anyone help me? ...

iPhone app not reloading data after reopening

Hi I am new to objective-c and iPhone app development. Currently I've been faced with a problem that I'm not sure how to fix. The problem is that I want my app to completely close and release all data when the user presses the home button and then when the user reopens the app it refreshes the data from my online server. I am currently ...

One category per method vs. all methods in one category? (ObjC)

Hi, Should I put all my methods in one category (I mean for the same kind of object) or should I split them up in many files? (Something like NSStringAdditions vs. NSString+this and NSString+that) ...

Cancelling NSOperationQueue from within NSOperation

I have some iPhone SDK 4.0 code which initializes an NSOperationQueue and then adds three classes (ClassA, ClassB, and ClassC) to run one after the other. ClassA, ClassB, and ClassC are all sub-classes of NSOperation. The relevant code is included below. ClassA *classA = [[ClassA alloc] init]; ClassB *classB = [[ClassB alloc] init]; Cl...