Hello,
I want to have a constant in my project to change between Lite and Pro version. I don't think it is the best way to do it, but I am trying to:
add a constant in my app delegate
#define BUILD_PRO 1 //0 => LITE, 1 => PRO
when I need it I import the appDelegate and test it:
#import "myAppDelegate.h"
then later
#if (BUILD_PRO...
Hey all,
I'm trying to make a MJPEG viewer in Objective C but I'm having a bunch of issues with it.
First off, I'm using AsyncSocket(http://code.google.com/p/cocoaasyncsocket/) which lets me connect to the host.
Here's what I got so far
NSLog(@"Ready");
asyncSocket = [[AsyncSocket alloc] initWithDelegate:self];
//http://kamera5.vfp....
It seems pretty clear that it is supposed to set things up.
When exactly does it run?
Why are there two brackets?
Is __attribute__ a function? A macro? Syntax?
Does this work in C? C++?
Does the function it works with need to be static?
When does __attribute__((destructor)) run?
Example in Objective C:
__attribute__((constructor))
s...
Hi, I'm creating images using an NSOperation subclass; threads are spawned to create the images which are displayed in an imageView. The images are set as a key in an arraycontroller, which is bound to the imageview.
Users are randomly reporting the app crashes and the crash log is showing an error in a thread calling the selector _cac...
Hello, surely, there is a shorter way to do this?
NSString *filePathA = [[NSBundle mainBundle] pathForResource:@"A" ofType:@"txt"];
NSString *myTextA= [NSString stringWithContentsOfFile:filePathA encoding:NSUTF8StringEncoding error:nil];
NSArray *arrayStructuresA = [myTextA componentsSeparatedByString:@"-"];
NSString *filePathB = [[...
So... I've written my first iPhone game, that consists of maybe 50 puzzles.
At the start of each puzzle I create some strings, various mutable arrays of pointers, some of which point to runtime created subviews. All retained variables are declared as various class properties. Then at the end of the puzzle I remove the subviews, release...
Hi, how can I skin the look of the button in UINavigationBar?
Tried this
UIBarButtonItem *myToolbarItem = [[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"myImage.png"] style:UIBarButtonItemStyleBordered
target:self action:nil] autorelease];
Doesn't quite do it.
Thanks,
Tee
...
I'm fairly new to UI programming on the Mac and iPhone, and I've run across something that somewhat puzzles me.
A UIViewController has 3 methods that involve the initialization of it and its view:
init (and init-like methods)
loadView
viewDidLoad (delegate method)
I'd expect these to occur in the order above. First UIViewController ...
Hi
I get some GPS coordinates from Google Maps and I need to find the distance between them
using Objective C. I have implemented the formula but I get results that are way to big.
I have tested the values from Google Maps by passing them back into Google Earth and a Geocoding service on the internet and everything checks out. Im now b...
Hi,
I want to port a python app that uses mechanize for the iPhone. This app needs to login to a webpage and using the site cookie to go to other pages on that site to get some data.
With my python app I was using mechanize for automatic cookie management. Is there something similar for Objective C that is portable to the iPhone?
Than...
Alright, so I'm trying to add a slash screen to my app to facilitate navigation. However, I'm quite lost as to where to begin. I'll have several different views that I want to access from the splash screen, and I want to hit a button to get to each of the views. So basically, think of the Facebook App splash screen. That's what I wan...
This function rotates a CGImage by an arbitrary number of degrees, but it clips the image a bit. How can I avoid the clipping?
Making the rectangle a bit larger seems to distort the image being rotated.
+ (CGImageRef)CGImageRotatedByAngle:(CGImageRef)imgRef angle:(CGFloat)angle {
float angleInRadians = angle * (M_PI / 180);
float...
I am currently developing an iPhone application which loads data from an RSS feed and displays it in a Tab Bar Application in 2 UITableViews, which we we call TableViewA and TableViewB. In the AppDelegate we have the following method:
- (void)getDataWithContext:(NSManagedObjectContext *)context
{
NSAutoreleasePool *pool = [[NSAutore...
Hi,
I had a question when showing sheets in Cocoa and particularly, the animations. How do I show a sheet (plain NSWindow/NSPanel) with and without the nice animation? It does this automatically for NSSavePanel/NSOpenPanel, but I can't get the nice animation working for a standard NSWindow/NSPanel sheet I create in Interface Builder. (W...
I am looking around the net and find this function onEnterTransitioDidFinish. I found it quite similar to viewDidLoad in Cocoa but not sure. Could anyone explain to me how to apply onEnterTransitionDidFinish pleasE? I am still new to Cocoa and Cocos2D. Please help me, my sincere thanks
...
I'm having trouble getting my UI to reflect external changes (made by another process) to an sqlite data store.
I have a fairly standard core data based NSArrayController / table view. My app gets notified that external changes have been made to the data, at which point I do a
[managedObjectContext reset]; // brute force, but data set ...
I need to format a float (catchy title, he?) to 2 decimal places, but only if those decimal places have values that aren't zero. Example:
I have a NSTextField named 'answer', after I do some math with a couple of floats, I want to assign my 'answerFloat' variable to the 'answer' NSTextField. So far I've got:
[answer setStringValue:[NSS...
I'm unable to build a very simple program when building for the iPhone simulator. It compiles fine for the device however!
An example code that the compiler doesn't like:
@protocol Invokable
- (id) invoke: (id)arg with:(id)data;
@end
@interface Worker : NSThread
{
NSAutoreleasePool* memoryPool;
}
- (void) invoke:(id)target select...
Greetings,
I'm sure that this is probably an incredibly stupid question, but...
What does the following line actually do?
string = @"Some text";
Assuming that "string" is declared thusly in the header:
NSString *string;
What does the "=" actually do here? What does it do to "string"'s reference count? In particular, assuming th...
I am newbie to Iphone Application development. Please help me. I am sorry if I am wrong. I have following declarations:
//.h file:
NSMutableArray *dataArray;
NSMutableDictionary *item;
//.m file
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedN...