I have a table view setup which currently, when being flickered up, has its sections flush up against right underneath the status bar, instead of flushing against the the navigation bar. I'm not sure if this is the proper behavior, but most applications have the Section Title flush properly below the navigation bar when it's slid into vi...
I noticed methods marked optional in several protocols defined in the iPhone SDK, such as the UIActionSheetDelegate protocol for example.
How can I define a protocol of my own, and set a few of the methods as optional?
...
It is to my understanding that one should use a forward-class declaration in the event ClassA needs to include a ClassB header, and ClassB needs to include a ClassA header to avoid any circular inclusions. I also understand that an #import it a simple ifndef so that an include only happens.
My inquiry is this. When does one use #import ...
Hey,
We have a JavaEE server and servlets providing data to mobile clients (first JavaME, now soon iPhone). The servlet writes out data using the following code:
DataOutputStream dos = new DataOutputStream(out);
dos.writeInt(someInt);
dos.writeUTF(someString);
... and so on
This data is returned to the client as bytes in the HTTP ...
I have a controller class from which I call a method of model class. Now from this model class method I want to update textView object which is a data member of controller class continuously. I have method in the controller class to edit this textView. I tried creating a controller object from the model class method and edited the textVi...
I'm extending the functionality of a class with a subclass, and I'm doing some dirty stuff that make superclass methods dangerous (app will hang in a loop) in the context of the subclass. I know it's not a genius idea, but I'm going for the low-hanging fruit, right now it's gonna save me some time. Oh it's a dirty job, but someone's gott...
what's the best way to throw an exception in objective-c/cocoa?
...
When implementing an +initialize or +load method in one of your Objective-C classes, should you always start with this kind of guard?:
@implementation MyClass
+ (void)initialize {
if (self == [MyClass class]) {
...
}
}
...
@end
Seems like code in +load and +initialize usually only wants to be executed once. So this w...
This is a program I'm writing (myself as opposed to copying someone else's and thus not learning) as part of the ObjectiveC and Cocoa learning curve. I want to draw simple shapes on a NSView (limiting it to ovals and rectangles for now). The idea is that I record each NSBezierPath to an NSMutableArray so I can also investiagte/implement ...
I'm following the sample code in CFNetwork Programming Guide, specifically the section on Preventing Blocking When Working with Streams. my code is nearly identical to theirs (below) but, when I connect to my server, I get posix error 14 (bad address -- is that bad IP address (except it's not)? Bad memory address for some call I made? ...
In Apple's NSObject documentation, NSZoneFree is called in the - (void)dealloc example code:
- (void)dealloc {
[companion release];
NSZoneFree(private, [self zone])
[super dealloc];
}
You can find it in context over here.
I never had the notion that I should be calling NSZoneFree in my own NSObject subclasses (or what NS_...
I'm new to Shark, and I was wondering if it's possible to narrow down a time sample to one specific method?
Let's say I'd like to, just for the sake of it, know how much resources have been used on calls to the method 'count' for all NSArray (or subclasses) instances.
...
When deploying the application to the device, the program will quit after a few cycles with the following error:
Program received signal: "EXC_BAD_ACCESS".
The program runs without any issue on the iPhone simulator, it will also debug and run as long as I step through the instructions one at a time. As soon as I let it run again, I wi...
Hi all!
Given
@interface Canvas:NSView {
NSNumber * currentToolType;
...
}
declared in my .h file
and in the .m file
- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
currentToolType=[[NSNumber alloc]initWithInt:1];
}
return self;
}
and further down
-(void)m...
Hi all!
I have a problem redrawing a custom view in simple cocoa application. Drawing is based on one parameter that is being changed by a simple NSSlider. However, although i implement -setParameter: and -parameter methods and bind slider's value to that parameter in interface builder i cannot seem to make a custom view to redraw itsel...
I'm in a hypothetical situation in which I need to list students in a school. I have one table view controller that has several sections, representing a school. Each school has subsequent students. Now, I have the requirement to give the user the capability to view all students for a particular school by clicking on the school name in a ...
So here's what I've got:
An NSTableView with an NSMutableArray data source
FSEvents monitoring a folder that contains the file that contains the data for the table view (Using SCEvents for Objective-C abstraction goodness)
The FSEvents triggers the same function that a reload button in the UI does. This function refreshes the table vi...
I'd like to add a logo to the left of my title on my navigation bar. The title property seems to only take an NSString. What's the best way to add an image to the navigation bar?
...
I have the following code which is trivial at first sight. I simply set want to set the font type to "Georgia" with a size of 14 if the cell is from the result of a search or if there is a count of zero in my students array. However, with this particular code cell that's last in my tableView is taking on the font of Georgia with size 14....
When compiling this:
char *str = [[NSString stringWithFormat:@"%i days and %i hours", days, hours] UTF8String];
I get this warning:
initialization discards qualifiers from pointer target type
How do I get rid of it?
...