objective-c

persistent view controller

Im building an iphone radio application and I want to have the controls, play, pause, stop, etc. in a tool bar (a custom view controller) at the bottom of the application. I want to keep this there throughout all the views so you can control the audio while navigating through the other parts of the application (multiple view/table contro...

UISplitViewController: remove divider line

When using UISplitViewController on the iPad there's a black vertical divider line between the root and detail view. Is there any way to remove this line? Thanks ...

How to swap values in NSMutableArray?

This piece of codes segment fault on me, any idea why? allButtons is a NSMutableArray, it contains 3 objects, a=0, b=1, a and b are int type if(a != -1 && b!= -1){ //Swap index in "allButtons" id tempA = [allButtons objectAtIndex:a]; id tempB = [allButtons objectAtIndex:b]; [allButtons replaceObjectAtIndex:a withObject:...

Iphone: Problem with moving back and forth between two UIViewController

Let me first describe the context of the problem. I have 2 UIViewController call AdminViewController and ButtonReorderViewController. AdminViewController contain 1 button. ButtonReorderViewController contains 1 button and 1 picture. Button in AdminViewController tie to an event call goToReorderButton. The content of goToReorderButton are...

URLEncoding a string with Objective-C

I'm trying to URL encode a string to form a GET request from objective-c. NSString *params = @"'Decoded data!'/foo.bar:baz"; NSRunAlertPanel( @"Error", [params urlEncoded], @"OK", nil, nil ); This is the category extending NSString -(NSString *) urlEncoded { NSString *encoded = (NSString *)CFURLCreateStringByAddingPercentEsc...

iPhone animation based on touch

Hi there, I am working on an iPhone app at the moment and I am struggling with some animation. Basically I have 109 frames for dragging about a man on screen, so what I am doing is listening for touches, and calculating which frames I need to switch to. This works all well and good, but after a while I get a memory leak and the app cra...

Objective-C int to char

Hi, How do I convert an int to a char and also back from char to int? e.g 12345 == abcde Right now I have it using a whole bunch of case statement, wonder if there is a smarter way of doing that? Thanks, Tee ...

iPhone UIButton Tap

Hello all, I am trying to make a button that response to single and double tap. I am trying to do this using myAction method. The problem is that first time when I press the button the method myAction isn't called. Can somebody tell why this happening and how can I fix that? -(IBAction)myButton:(id)sender{ UIButton *theButton = (UI...

Objective-C RGB to HSB

Let's say I've got the colour FF0000, which is red. Finding a darker colour is easy, I just type maybe CC instead of the FF, but let's say I've got the colour AE83FC, which is a complicated colour, how the heck would I find a lighter or darker version of it automatically? I figured the easy way to do this is to convert my RGB to HSB [Hu...

NSString - Unicode to ASCII equivalent

Hello, I need to convert NSString in unicode to NSString in ASCII changing all local characters: Ą to A, Ś to S, Ó to O, ü to u, And do on... What is the simplest way to do it? ...

dynamicly loading content into scrollview while scrolling

hi there. I'm facing a problem with my scrollview (horizontal, paging enabled, can be 50 pages or more) what i want to do is, load content onto the scrollView's content-View while the user is scrolling horizontally (because initially loading all the content takes way to long). what i do is: everytime a scrollViewDidScroll happens i che...

shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight.

Hi guys, I am using auto rotation for only single view controller that is for webview controller.Auto rotation working fine while I came back from portrait mode to previous controller but when I came back from landscape mode to previous its working but when I move to next webview controller from portrait mode to landscape mode its not w...

how can i access a value on a cell in tableview from different class?

I can hold the value of touched cell but I cannot pass that value to another class or call from that class. SearchTableViewController.m **deneme= [[NSMutableArray alloc]init]; deneme=[tableData objectAtIndex:indexPath.row]; NSLog(@"my row = %@", deneme); //I can hold one of the selected or touched rows in table HistoryTableViewContr...

What is the use of extern in declaring constants?

Hi all, can please tell me what is the use of extern variable when declaring the constant variables in different file. ...

Function should return float, but it gets messed up!

Hi guys, I'm going crazy here. I have a function that should return a float number: - (float) getHue:(UIColor *)original { NSLog(@"getHue"); const CGFloat *componentColors = CGColorGetComponents(original.CGColor); float red = componentColors[0]; float green = componentColors[1]; float blue = componentColors[2]; ...

Objective-C View drawRect: change the Rect

In my UIView's drawRect, there's a parameter rect, which is a CGRect, where would I change this rect? I'd like to use it as a camera for a game that I am making, such as rect.origin.x = myCamera.x; rect.origin.y = myCamera.y; and then my drawing functions should draw it where the camera is placed... How would I change the rect? ...

Compiler warning when passing NSError ** as a method parameter

I've been scratching my head about this for the last 4 hours, trying out all kinds of little experiments, but I can't seem to figure out what's going wrong. Could this be a compiler bug? Test.m: - (id)initWithContentsOfURL:(NSURL *)aURL error:(NSError **)error { if (!(self = [super init])) { return nil; } return sel...

How can get the values of NSDictionary using keys where the dictionaries are stored in NSArray ?

I have created 5 NSDictionary's. I stored them in NSArray. I need to get the values stored in NSDictionaries. How can do it ? I tried calling [[array objectAtIndex:i]objectForKey:key1]. But, it is crashing by giving the message:unrecognized selector sent to instance How to get the data ? NSDictionary *enemy1, *enemy2; NSArray *enemyDat...

UIScrollView problem on iPhone and iPad

Hello guys! I am adding 6 subview to my uiscrollview. Then I scroll it and there appears 2 more views. These two views are UIImageViews. What do you think? What are they appear there??? That's very strange. ...

Xcode raises exception when refactoring

When I run a refactor on my code in xcode, all the files are correctly refactored except one, and when I click to check the changes made in that file, the following 'Internal Error Occurs': Uncaught Exception: Invalid parameter not satisfying: fileName Stack Backtrace: The stack backtrace has been logged to the console. Here is what ...