objective-c

Working with text fields in a UITableView

Hi I am making a search form with a number of free text fields that I would like the user to edit in line on a tableview (and not go to a seperate view for each individual item). So far I have it so when you press on the field, a text input dialog appears, here is the relevant code: - (UITableViewCell *)tableView:(UITableView *)tableVi...

How to write this method in Objective-C?

I just started Objective-C recently, and this has once again gotten me to the point of asking SO for help. I need to rewrite this method so that I can call it using [self URLEncodedString]; This is what the method currently looks like - - (NSString *)URLEncodedString { NSString *result = (NSString *)CFURLCreateStringByAddingPerce...

Default Navigation Bar Color

I have some items that change the navigation bar color when the detail pages are accessed. My issue is getting back to the default navigation bar color. What color is it? It is not blue or gray for sure. Also when going "back", where is the best place to put this color change? Unload does not seem to work for this. On the table view con...

Implementing GetBSDProcessList from sysctl.h

Hello, Could someone give me some advice or a snippet of code that would show me the way of implementing the method in this listing . I would like to get some info about processes on a mac. I'm not so good with C, but am familiar with Objective C. Thanks! ...

Simple iphone networking in different threads

I guess my question stems from ignorance on how network communication is done on different threads on the iOS platform. I have a TcpConnection class which is a wrapper for input and output streams to a printer. the Open call looks like this: CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault, (CFStringRef) ipAddress, port, &read...

A better way to stagger method calls/display 3 UIImageViews in delayed sequence

Hi all. I've managed to implement a solution to this problem, however the code just seems rather inefficient and actually, the delayed method calls are proving a little troublesome when they continue to fire if the user has navigated to another screen. Basically I want a thought bubble to appear from a character's head, but animated, so...

iPad: problems with table rows in popovercontrol

Hi eveybody. I have an iPad application which implements the UISplitViewController. As usual I'm using the popover button to show the root view when the device is in portrait mode. It's seems to be ok at time of launch, but if I turn the device to landscape, then back to portrait, the table in the popover, will have an additional blank r...

What's the purpose of an ivar when a property exists?

The following doesn't complain at compilation nor runtime about no name ivar. So why is it so common to see an ivar and @property/@synthesize. @interface PropTest : NSObject { } @property (retain) NSString *name; @end @implementation PropTest @synthesize name; @end int main (int argc, const char * argv[]) { NSAutoreleasePool * pool ...

Alloc and init buffer and play DTMF

I want to allocate a memory buffer and initialize it with data of a mathematical equation in order to gain a pure DTMF tone. I am using the AudioQueueServices library to allocate and fill the buffer. I used a formula of 2 sine waves and 2 different frequencies. However, neither a sound nor a tone is not played. It may be important to me...

Next Item in Plist Button

Hey guys, i have a simple app just a load of images in one image view. Each is just included in a plist file and called when a cell is selected in popover window. All i want is a button with an action to get next item in plist and display in the image window. this sounds easy but i cant figure out the code to grab next item in plist? can...

touchesBegan & touchesMoved

So here's a weird question. I have a UIImageView that responds to touchesMoved & touchesBegan, it works perfectly. The main thing I'm having an issue with is if you put your finger down on say image1 and then with that finger still down on image1 you would press image2 with your other finger. In turn this would fire image1 again. Dont ...

How to set custom view for UIBarButtonItem?

I am trying to put a label in a UIBarButtonItem. Here is my viewDidLoad method: characterCountLabel = [[UILabel alloc] init]; characterCountLabel.text = @"HELLO"; charCountButton = [[UIBarButtonItem alloc]initWithCustomView:characterCountLabel]; Everything is hooked up properly in IB. Why is the label not appearing inside of my UIBarB...

NSLocale - get all available languages

is there a way to get all available languages on the iphone just like in the settings app? can't find a method in NSLocales Class Reference. thanks! ...

iPhone Objective-C: Ensure user allows location sharing before doing other actions

My application asks for location at the log in screen, and right now, the user can log in without sharing his or her location. When the user selects "No" for sharing location, an error that reads Error Domain=kCLErrorDomainCode=1 "The operation couldn't be completed. (kCLErrorDomain error 1.)" is thrown. I'm guessing that's because I am ...

UITextView: How to set '\n' from an XML-loaded string?

I need to indicated a 'new line' in a string in an XML file I'm loading. If I hard code the string: myTextView.text = [NSString stringWithString:@"Line1 \nLine2 \nLine3"]; It displays: Line1 Line2 Line3 (as expected) But if I put the exact string in my XML file: <someNode string="Line1 \nLine2 \nLine3" /> And then load it in...

Improper Return Value using NSFileManager createDirectoryAtPath:

Hi Everyone, I'm working on a new feature for an existing iPhone application, and would like to create several new directories in the application's local "Documents" folder. I have successfully done this using the recommended method: [NSFileManager createDirectoryAtPath:withIntermediateDirectories:attributes:error:] When reading the ...

Would I ever want to use any @property attributes other than "retain" and "nonatomic" for UI variables?

I'm diving into iOS development and I find that for each of my UI controls, I always just blindly declare their @property like so, since that's how it was done in some tutorial I read when I started learning... @property (retain, nonatomic) IBOutlet UILabel *lblStatus; I'm still getting familiar with these attribute types and what the...

Is it possible to tile images in a UIScrollView without having to manually create all the tiles?

In the iPhone sample code "PhotoScroller" from WWDC 2010, they show how to do a pretty good mimmic of the Photos app with scrolling, zooming, and paging of images. They also tile the images to show how to display high resolution images and maintain good performance. Tiling is implemented in the sample code by grabbing pre scaled and cut...

UITextField editing issue - iPhone SDK

Hi all, I am having an issue with my UITextFields in my iPhone app that I am hoping someone here may have seen before. I have a few UITextField's on my screen, and when they are tapped and they keyboard appears they are covered. To overcome this, I animated the view to move up with: -(void)moveViewUpFromValue:(float)fromOldValue toNe...

Add a sublayer to a CALayer without animation?

How can I add a sublayer to a CALayer without animation? Usually when you add one it "fades in" and when you remove one it "fades out". How to supress the animation? ...