In the section titled 'Memory Warnings' here http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmNibObjects.html, I don't follow why the IBOutlet is set to nil in the dealloc. If
self.anOutlet = nil
causes a crash as mentioned in the topic, why are they setting the ivar to nil?
In general, ...
I'm hosting a webkit frame in my objective-C application and trying to execute some javascript on the loaded document using stringByEvaluatingJavaScriptFromString. Every call I make to document.getElementsByTagName('*') or document.getElementsByTagName('a') returns 0 length collections, regardless of the page I load in my webview. Othe...
Hi,
I pretty new to Objective-C (and C itself) and need to consume a NSData from a HTTP output. I've never really worked with byte arrays or had to worry about little/big endian issues, and have struggled a bit to write the following method to read a NSNumber with a specified length from that NSData.
- (NSNumber *)readNumberWithLength:...
Hi, is there a way to capture application that was previously active, before my application was brought to front by user?
I've tried to this in applicationWillBecomeActive: delegate method, but my application is already mark as active.
Thanks.
...
I have a view that I want to take up the full screen, so I override the init method, and some of the view methods:
- (id) init {
if (self = [super init]) {
self.wantsFullScreenLayout = YES;
}
return self;
}
- (void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[UIApplication sharedApplication] setStatu...
I'm writing a Cocoa application, which uses NSURLs -- I need to remove the fragment portion of the URL (the #BLAH part).
example: http://example.com/#blah should end up as http://example.com/
I found some code in WebCore that seems to do it by using CFURL functionality, but it never finds the fragment portion in the URL. I've encapsu...
I want to keep my keyboard up after I input something since I am gathering up multiple answers for one question.
So far I am calling:
- (BOOL)textFieldShouldReturn:(UITextField*)textField {
[textField resignFirstResponder];
return YES;
}
But when remove resignFirstResponder, I am not getting any response for my input handler on t...
Suppose I have following data in my game. I have developed game in cocos2d.
Name Score
Sagar 10000
Amit 2000
Vishal 90
Above data is stored in plist file.
Plist has an array as root.
Within that there are 10 dictionary.
Each dictionary has two values.
String values - Name
Number value - score
When I use
NSMutableArray...
I'm working on a game like Rodents Revenge, just to point out where I'm coming from with this question. I'm using the cocos2d game engine aswell...
I have a layer that contains about 168 blocks, these blocks are a subclass of a Sprite. Each block contains two instance variables that are integers, one for the xGridLocation and yGridLocat...
Is there a way to add a location from an MKMapView in my application to the built-in Google Maps app?
From what I understand there is probably one of two ways to do it: using [[UIApplication sharedApplication] openURL:xxx] (like opening a web address, writing an email, or dialling a number) or using a C-api like adding a contact to the ...
This is on the iPhone.
So what if I have a function like
- (SomeObject*)buildObject;
Do I need to pass in a variable that I have already alloc'd outside like
- (void)assignObject(SomeObject** out);
Or can I do
- (SomeObject*)buildObject
{
return [[[SomeObject alloc] init] autorelease];
}
and use it like
SomeObject* obj = [[...
I need to create static constants in a class that can be used by other classes that import that class.
I'm assuming that enum would be the best way to go since I have seen it been used quite often through out Cocoa classes.
...
I have a UIImageview in my application and I was wondering how I can show an image in it pragmatically and change it whenever I want to! I think my major problem is exactly WHERE to put it! If you could show me what code and where that would be very usefull! thanks!
EDIT: Also if you can pragmatically change the background into an image...
Ok so I have this code
NSMutableArray *smartThings = [[NSMutableArray alloc] initWithCapacity:3];
NSMutableString *smartString = [NSString alloc];
int random;
int numOfThings = 1;
random = arc4random() % numOfThings;
smartString = [smartThings objectAtIndex:random];
UIAlertView *smartAlert = [[UIAlertView alloc] initWithTitle:@"Thing To...
I want current time in following format in a string.
dd-mm-yyyy HH:MM
How?
Thanks in advance.
Sagar
...
I have a checklist in a UITableView and I have a UISegmentedControl with "Select All" and "Deselect All" options.
I am wondering how I can reset all the cells while viewing the table. The [self.tableView reloadData]; function does not seem to do the trick.
Any thoughts?
Thanks!
...
Hi all,
I'm writing a program in OS X that receives click events from a mouse and a touchpad. When the user clicks at somewhere, the OS sends the device ID, which is just an int, and the position of the cursor to my callback function. I want to know if the click event comes from mouse or touchpad. So, how can I know the device's name fr...
I am writing a string tokenizer in Objective-C for an iPhone application.
I have the result as:
1|101|Y|103|Y|105|Y|107|Y|109|Y|111|Y|113|Y|115|Y|
I want to tokenize this string and display each of the values in tabular format. How am I to do it?
I want the result in a tabular format. Like:
102 Y
103 Y
.. ...
...
Does anyone has any idea how can I capture screen using objective c in mac os?
to be more specific, how can I capture the active / focused application screen then create an image into a specified path.
Any help is highly appreciated.
...
hi i am new to objective c. i have a login view controller with .h, .m, .xib files.
and after successful login i need to go to the second page.
The scenario is this, i am accessing web services. to authenticate the user, i send the username and password to the web service and in return i get a string value.
based on the results of the...