cocoa-touch

NSURL not instantiating properly

Hi, I am new to IPhone developing. I have got very strange issue with NSURL which is driving me crazy. I want to instantiate NSURL object to use it in loading image. But instantiation never happens in proper way. It always says my url in invalid. Basically I use code like below: NSString *str = @"http://google.com"; NSURL *url = [NSUR...

Moving the position of the back item in a UINavigationBar iPhone

Trying to move the position of the back item on the UINavigationBar by getting a handle to the backbutton however I only seem to be able to make it disappear rather than do anything with it I have the following in viewDidLoad self.navigationItem.leftBarButtonItem.title =@"Testing"; self.navigationItem.backBarButtonItem.title= @"1234";...

Cocoa-Touch: How to do layouting.

I have a view (UIScrollView), which loads some data, and displays various things from it in various subviews. So I have approx 10 subviews (UIImageView, UILabel) and I need to place them programatically considering their unpredictable contents (i.e. different height/width for the UILabels depending on the text property). From what I've ...

what is this iPhone UI technique called?

In iPhone UI terms, what's the name of the effect that causes additional options to appear when you tap-and-hold an element? For example, when you hold down the "e" keyboard key for a moment, causing the additional accent mark buttons to appear. Is there an established approach to implementing this effect, or should I code it up from s...

Adding text after the the rows removed

Could anyone help me solve this problem please? I have a option called favorite, each time I choose my favorite song, the song will be added into inside that favorite option. So I made a table for it, and each cell will store each song the i choose. I can remove the song as well. But before I choose any song, inside that table I want it...

How does iStat for iPhone get the WiFi MAC & task list

Hello, iSTat shows a list of running tasks and also shows the Mac address of the Wifi connection. I understand that there's a way to get the Mac address via NSHost but it seems to be a private API. Also the task list is a mystery to me. Where do they get all that information from? Thanks! ...

How to call Objective-C from Javascript?

I have a WebView, and I want to call a view in Objective-C from JavaScript. Does someone know how I can do this? ...

How to define a BOOL constant?

I know how to do it for a float: #define kMyConstant 1.0f but how could I do that fora BOOL value? ...

Where do I have to declare static variables?

i.e. I want to bring this in my code: static BOOL MyConstantBool = YES; Must it be before or after @implementation? Are there rules where to place that? Can it also go into the header file? ...

Is it good style to declare methods in .h when they're intended to be overwritten by subclass?

I have a class which is intended to be abstract. This means: When someone subclasses it, a few methods MUST be overwritten. But on the other hand, those methods are not intended to be called manually from anywhere except inside the abstract class (the superclass of the subclass). Must I declare these methods in .h anyways or can I just...

How to draw an UIImage or directly in -drawRect:?

I have an UIImage which I want to draw on a UIView. But instead of creating an UIImageView and adding this as an subview, I want to overwrite -drawRect: and draw my UIView directly. For example, my code looks like: - (void)drawRect:(CGRect)rect { CGContextRef myContext = UIGraphicsGetCurrentContext(); UIImage *img = [UIImage i...

UINavigationController viewController intra communication.

Whats the best way for UIViewControllers that are pushed onto a UINavigationController to communicate with each other? Method chaining back up to the root most parent view controller? Connecting references to other view controllers w/ IB? ...

iPhone SDK: How to display a view controller within another?

Fundamentally, what I want to do is within, for example, ViewControllerA display ViewControllerB and ViewControllerC. How would I do that? Thanks in advance. ...

UITextField ellipses

I have a UITextField but when it overflows I want it to scroll not use an ellipses. Can you do this on the iPhone? ...

UITextView hasText not working?

I am assigning the contents of the clipboard to the UITextView text property. However, when I check the hasText property, the condition is always false. NSString paste_text = [[NSString alloc] init]; self.paste_text = [UIPasteboard generalPasteboard].string; .... my_UITextView.text = self.paste_text; //THIS CONDITION IS ALWAYS FAL...

How to implement UIImageView-like delayed loading in UITableView

Hi all Background: I have a UITableView showing an image in each cell. These images are all part of a big pdf-file. So what I am doing is actually rendering little pdf-parts in those UITableViewCells, each cell displaying just one piece. Therefore I add a UIView to the contentview of the cell and render the view on demand. Rendering the...

Possible View Caching problem?

I'm building an iphone app and I've got a table view with some textfields inside the cells, the content of the fields is set in viewWillAppear (its a grouped TableView w/ 3 fields that are always the same). The content of the text fields is retrieved from getter methods that return values from various class variables. The problem I'm h...

NSMutable Array

Hello, I have a NSMutableArray: NSMutableArray *temp = //get list from somewhere. Now there is one method objectAtIndex which returns the object at specified index. What I want to do is that, I want to first check whether an object at specified index exists or not. If it exists than I want to fetch that object. Something like: if (...

How to get an string representation from an NSDecimal without any formatting?

For example, I have an NSDecimal myDecimal. Lets say it represents something like "-1234567.89" How can I get a clean string representation of that decimal without any beautification / formatting? No localization? Floating point symbol = . and rest only numbers from 0 to 9, and eventually an - if it is negative? I need that string in st...

Does removeObject release the object in an NSMutableArray of objects?

I was wondering when you remove an object using removeObject in an array if that removed object is handled properly. Would the object being removed be released? ...