I can use this method to show my location at first.
-(void)displayRegion:(double)latitudeDouble: (double)longitudeDouble{
CLLocationCoordinate2D coord = {latitude: latitudeDouble, longitude: longitudeDouble};
MKCoordinateSpan span = {latitudeDelta: .005, longitudeDelta: .005};
MKCoordinateRegion region = {coord, span};
...
I'm trying to resize an image loaded from disk - a JPG or PNG (I don't know the format when I load it) - and then save it back to disk.
I've got the following code which I've tried to port from objective-c, however I've got stuck on the last parts. Original Objective-C.
This may not be the best way of achieving what I want to do - any...
Can anyone tell me what the scope of the static variable in the class below is?
@implementation SharedManager
static id myInstance = nil;
+(id)sharedInstance {
if(myInstance == nil) {
myInstance = [[self alloc] init];
}
return myInstance;
}
In a test I created an instance from the class and then released it, but ...
I came accross this on the Mike Ash "Care and feeding of singletons" and was a little puzzeled by his comment:
This code is kind of slow, though.
Taking a lock is somewhat expensive.
Making it more painful is the fact
that the vast majority of the time,
the lock is pointless. The lock is
only needed when foo is nil, which
...
Hi.
I have a UITable View with a textfield that is editable right on the view (like Phone in contacts, etc.). I want to enable/disable my save button conditional up text being present in this field. So, I want the button to start out as disabled (for a new record) and then, as soon as I type the first letter into my text field, I want t...
In my constructor, I want to create a random color.
Therefore, I need three random 7-bit floats in the range of 0…1 that make up the red, green and blue component of the color. Instead of writing the rather long random() % 128 / 128.0 three times, I put that in a block:
CGFloat (^randFloat)() = ^(){ return random() % 128 / 128.0; };
co...
I would like to have an object be callable from the main thread
MyObj* backgroundObject = [[MyObj alloc] initInBackground];
BOOL result = [backgroundObject computeResult];
But have all the methods of backgroundObject compute in another thread.
And also have backgroundObj be able to send messages to it's delegate. How can I do such a ...
I am writing an objective-c model to hold all of the data parsed from an XML connection. I am using an NSURLConnection to download the data asynchronously and it is then passed to the parser. I have done this before, but not with such a large xml file. I would like to garner some opinions on the best way to store the data. Here are s...
Hi
I am trying to create a re-sizable array of CGPoints in objective-c. I've have looked into using NSMutableArray however it doesnt seem to allow resizing. Is there something else I can use?
thank you
...
I get the following error when I try to build (Build->build) a unit test. My unit test is a logic test (it does not run on the device).
Things that are probably related to my problem are:
I am using libxml2 and a wrapper around it (which i found at cocoawithlove).
This wrapper has some C functions defined (it is not an Objective C cla...
I'm building an NSPredicateEditor, and I want the ability to do advanced date comparison.
I realize that I can build an NSPredicateEditorRowTemplate with a rightExpressionType of NSDateAttributeType, but the predicates I want to build need to be much more advanced than that.
For example, I need to basic comparison like:
dateKeypath <...
Hello everyone:
I'm working on a module for a project where the screen is in landscape mode when I get it. I have to load a new view, and switch to portrait mode. While this seems simple enough, I have not been able to find a simple solution. Here's what I tried:
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOri...
Hi,
In xcode you can use po object to see a textual representation of a given object. Is it possible to convert from this textual representation to a real objective c object?
Thanks
...
Hi
I've a table view with a custom image background of each cell. In normal mode the background is perfect and fill all the cell. When tableView enter in editing mode the "-" button appear on left and all the object are indented and in the left I've problem with background: there a white area. Can anyone help me? The background image is...
I'm new to core data and try to get all children objects of various types with one query. Say there's an "Animal" type as parent and "Cat", "Dog" and "Bird" as children. I'd like to get both cats and dogs, but not Birds in single query returned as Animal objects. Is it possible?
...
I can't identify the object being deallocated, I run my app with Command+Y but despite having MallocStackLogging set to YES and NSZombieEnabled set to YES, when I hit EXC_BAD_ACCESS in my app, gdb doesn't print the memory address of the deallocated object. Any ideas?
Apologies if this seems vague, it looks like it's Core Data related, ...
I need to display a UIView/UIViewController when the user taps a button and the modal view should appear just like how the key board appears from the bottom bar when you edit text in a UITextField. Using the following code, I get to show it as a pop up.
[self presentModalViewController:child animated:YES];
How to make it appear like ...
I have an NSMutableArray that is populated with objects of strings. For simplicity sake we'll say that the objects are a person and each person object contains information about that person.
Thus I would have an NSMutableArray that is populated with person objects:
person.firstName
person.lastName
person.age
person.height
And so on.
...
Hi,
I'm developing small FTP upload app. for mac (10.6 if it matters)
Have problem with NSStream, actually I cannot understand how to find our error by its code.
NSError code=14 domain=NSPOSIXErrorDomain
Where to check what does 14 means?
Thank you.
Just in case here is my code (maybe you can also tell me why I have an error)
NS...
could you show me algorithm for implement decode special HTML entities in Objective C?
any idea?
...