cocoa-touch

NSOuputStream writing multiple times

Hello, I'm trying to use the NSStream objects to open and then write and read on a socket but i have a problem. I don't know how to write on the socket, after i have opened it. Here is how i have done 1) first openning the socket : NSURL *website = [NSURL URLWithString:urlStr]; if (!website) { NSLog(@"%@ is no...

Testing CoreLocation on iPhone Simulator

Is there anyway to test CoreLocation on the iPhone Simulator? All I require is to be able to set the location myself and have CoreLocation return it. ...

Is it valid to say that a Getter is the owner of the instance variable? Or who owns it?

Actually I would say: yes, the Getter is the owner. So anyone who calls the Getter is not responsible for freeing the memory. Or more precisely, the object itself is the owner, but the Getter acts as a delivery mechanism of the instance variable to others. Is that right, or did I get that wrong? ...

Packaging a Bundle with a static library

I have a static library that includes some xibs. These will basically be the same across projects. I'd like to include the xibs as part of the library. I can include their veiwcontrollers, reference these controllers in the calling project but then there isn't a xib to load. When I right click the xib in the library project, it can't...

How do I update the UI in the middle of this thread?

Below is a block of code that runs in a separate thread from my app's main thread. How do I get the UI to update after each button gets its thumbnail? Right now it doesn't update until the whole method finishes. The buttons are already added to a UIScrollView. (LotsGridButton is just a UIButton with some extra properties.) - (void)fetc...

CATransaction Not Animating

I've created a new View-based Application in XCode. In the ViewController, the only code that I've modified looks like this: - (void)viewDidLoad { [super viewDidLoad]; UIView *newView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)]; newView.backgroundColor = [UIColor redColor]; [self.view addSubview:newView]; [CATransact...

How do I draw a shadow under a UIView?

I'm trying to draw a shadow under the bottom edge of a UIView in Cocoa Touch. I understand that I should use CGContextSetShadow() to draw the shadow, but the Quartz 2D programming guide is a little vague: Save the graphics state. Call the function CGContextSetShadow, passing the appropriate values. Perform all the drawing to which you ...

Why is there no need for releasing an Outlet that's set up with "assign"?

I've been reading that if I have something like this: @property (nonatomic, assign) UIView *anView; Then I don't have to care about memory management. I don't have to do [anView release] in the -dealloc method. Why? "assign" just tells the compiler: "Hey man, this property does not retain whatever anyone assigns to it". And then you...

Why should I write [anView release], anView = nil; rather than [anView release]; ?

Somewhere I was reading that - regarding low memory warnings and giving up an non-visible view with all it's subviews (= a whole nib, I think), you should do that: -(void)dealloc { [anView release], anView = nil; [someImageView release], someImageView = nil; [super dealloc]; } rather than -(void)dealloc { [anView rel...

iPhone + Sharepoint

Hey, is there a way to connect the iPhone with Sharepoint? I wonder, if it is possible to implement the HTTP or WEBDAV protocol of Sharepoint in Cocoa/Objective-C. Regards ...

Launch Image

I managed to design a fairly decent launch image/default.png. But I noticed that it just flashes for a second then goes to the UI. Is it possible to code the launch image and make it dynamic? Remaining on screen until the user touches it or a button. Or is this something one would definitely not want to do? Thanks, ~D1~ ...

Is "assign" the default setup of the @property compiler directive?

If I define an property and just do: @property(nonatomic) UIButton* button; then I think that it's an "assign" property. Is that correct? ...

What's the difference between @property and @synthesize?

Like I understand, @synthesize actually is generating the Getters and Setters. But what's @property then doing? Is it just setting up the parameters for that cool @synthesize magic function? ...

What's with [UITableView reloadData]?

I have an application that has a UITableView. This UITableView is populated by an NSMutableArray being held (as a property) in the appDelegate. You can think of this as an email window. It lists messages in a subclassed UITableViewCell. When a new message appears, I have all the code done which downloads the message, adds the data to the...

Memory Leak Issue with NSMutableArray

I wrote this function in a Helper class for reading a table from my database, and returning it to my controller. On my viewdidload, i cache this result into a class variable (retain property set) and trying to use that inside a picker view control's delegate method. (titleForRow) Somehow, I get a EXC_BAD_ACCESS when I try to access the...

UIButton: Making the hit area larger than the default hit area.

Hello, I have a question dealing with UIButton and it's hit area. I am using the Info Dark button in interface builder, but I am finding that the hit area is not large enough for some people's fingers. Is there a way to increase the hit area of a button either programmatically or in Interface Builder without changing the size of the I...

UILabel: Using the userInteractionEnabled method on a label

Hello again. I am wondering if anyone has used the userInteractionEnabled method on a UILabel to allow the label to act like a button (or just to fire off a method). Any help would be greatly appreciated. Cheers! Update (4/30/09 @1:07pm) Clarification: I have a standard InfoButton and next to it I want to place a label with the text...

Link to a constants file in Cocoa / Xcode

In reference to this related question on stackoverflow: If you create a constants file, how do you "link" to it in your target, so you don't have to #import "Constants.h" in every file you use constants? ...

When do you use encodeWithCoder: and initWithCoder: on the iPhone?

As my question in the subject above states, what requirements do you typically have to meet in order to say "Ok, I need encodeWithCoder: and initWithCoder: instantiation for this"? Typically you can write object state to NSUserDefaults, so I'm curious when do you experts decide to use one vs the other? ...

NSUserDefaults: Dumping the structure of NSUserDefaults's standardUserDefaults

Hi hi. Does anyone know of a quick way to dump the standardUserDefaults of NSUserDefaults via NSLog? This is what I have: NSLog(@"NSUserDefaults dump: %@", [NSUserDefaults standardUserDefaults]); But it returns: NSUserDefaults dump: <NSUserDefaults: 0x50b520> ...which is not quite what I'm looking for. I'd really like to have ke...