I have a cell in a table view that has a UILabel as a subview, when I set the text of the label, it is never shown on the cell. I'm somewhat a noob in iPhone development and am not sure what I'm doing wrong...
I am creating and returning the following cell in my table view's cellForRowAtIndexPath delegate:
cell = [[[ActivityCell allo...
NSArray* arr = [NSArray array];
int a = MIN([arr count], 1); // 0 correct
int b = MIN(0 - 1, 1); // -1 correct
int c = MIN([arr count] - 1, 1); // 1 WRONG
this is the definition of the MIN macro, in NSObjCRuntime.h:
#if !defined(MIN)
#define MIN(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B);...
here is my code snip, i dont know how to round double numbers.
double m = [tmpProduct.msrp doubleValue] ;
double d = [tmpProduct.discountPrice doubleValue];
double p = (d * 100 ) / m;
here tmpProduct.msrp and mpProduct.discountPrice are (NSDecimalNUmber *)
from the operation above I got p = 44.995757
i want to convert it to (45%) ,...
I have the following code:
@interface AXWindowController : NSWindowController {
IBOutlet NSTextField *text;
IBOutlet NSTextField *otherText;
}
- (void) setText: (NSString *)input;
- (void) setOtherText;
@end
@implementation AXWindowController
- (void) setText: (NSString *)input
{
[text setStringValue:input];
}
- (void) setOther...
I'd like to split up executing a query. The myprepare function below opens the database connection and runs the sqlite3_prepare_v2 function. Once sqlite3_open is executed within the scope of the myprepare, selectstmt and database have valid addresses assigned to them. However, once I come out of myprepare, their addresses are wiped t...
I'm reading NSFileHandleReadCompletionNotification messages from the NSNotificationCenter to receive messages from an NSTask. The problem is that the command line program I'm calling is relatively slow to output lines, and it seems that the NSFileHandleReadCompletionNotification message gets posted relatively infrequently (I guess when t...
I am developing an iPhone application which is navigation based. Whenever the application quits, the retain count of the navigation controller and the window is 3. Can somebody explain me how to overcome this issue? The dealloc method, as a result, is not getting called.
...
In iPhone technology how i can adopt the move in next search?
...
I have a custom object which conforms to NSCoding, since the object should be writable to disk on terminate. In this class I have various properties holding Cocoa object types such as NSStrings, NSArrays, NSDictionaries. One particular property is this one:
@property (readwrite, copy) NSArray *artistReleases;
It's actually an Array w...
I have a class that has been derived from NSObject. How can copy be enabled like [object copy]?
This is for an iPhone application.
...
Hi,
If someone have ever use the PhotoViewController and so the MockPhotoSource in the three20 open source project can he told me how can I change the code to display photo store locally and not in the internet.
This is an example of the code to display one photo:
- (void)viewDidLoad {
self.photoSource = [[MockPhotoSource alloc]
...
Hi everyone,
To help gather a sense of Objective-C I'm creating a very basic connect 4 game sans Cocoa.
In my program I have three modules:
"Game": Contains an array that holds the board information. Object that is created within main, and is responsible for turns. Player and Computer objects live within this module.
"Player"...
Can someone post an example of how I get an instance variable value that is a double?
I tried using the object_getIvar() function but that didn't go very well because it seems like this function is only good for variables that return objects and not scalar data type.
thanks in advance,
fbr
...
I have an NSOperation. When it is finished I fire a NSNotificationCenter to let the program know that the NSoperation is finished and to update the gui.
To my understanding listeners to the NSNotification will not run on the main thread because the NSOperation is not on the main thread.
How can I make it so that the listeners run on...
Hi. I want to fetch the machine's serial number key. Does any body help me on how to fetch the machine's serial number?
...
I created an NSOperation. Do I also need to create an autorelease pool for this or is it all handled for me like voodoo black magic?
...
I've defined a struct and want to assign one of its values to a NSMutableDictionary. When I try, I get a EXC_BAD_ACCESS. Here is the code:
//in .h file
typedef struct {
NSString *valueOne;
NSString *valueTwo;
} myStruct;
myStruct aStruct;
//in .m file
- (void)viewDidLoad {
[super viewDidLoad];
aStruct.valueOne = @"firstValue";
}
/...
I need to invoke an initial GET HTTP request with Basic Authentication. This would be the first time the request is sent to the server and I already have the username & password so there's no need for a challenge from the server for authorization.
First question:
1) Does NSUrlConnection have to be set as synchronous to do Basic Auth? Ac...
I want to find which applications are running, particularly I want to know which one has a window that has focus. So at any given time I want the app to know which application the user is actively working with. I can't figure out how to determine which app is selected, I can only see which window they are using in my app using keyedWindo...
I'm building a custom Xcode framework, and I have a class called AXController that has a class method called showActivationWindow. showActivationWindow initializes and shows a window using AXWindowController which is a subclass of NSWindowController. Then, AXWindowController calls activate which is a class method in AXController on a but...