On iPhone.. Why would code such as this cause memory leak? after 2 minutes the net bytes have doubled.
All I'm doing is moving a ball round the screen with an NSTimer calling the below method.
Any ideas?
- (void)nextFrame:(NSNotification *)notification {
ballInstance.frame = CGRectMake(value, 0, 320, 480);
}
...
I'm trying to learn and use Blocks effectively. On the web, I've come across this tasty morsel of code:
long long (^blockFun)() = (long long (^)())moreBlockFun;
it confuses the heck out of me. I think it's trying to create a block that expects a block that returns a long and i think it's doing some casting somewhere too, just for fu...
Under NSTimeZone class, there is both +localTimeZone and +systemTimeZone. I did a test on iphone simulator, both return NSTimeZone object indicating the same timezone. What is the difference? Which one I should use to find out the timezone setting of the iPhone? Thanks
My test:
NSLog(@"Local Time Zone %@",[[NSTimeZone localTimeZone] na...
-(void)setX:(int)x andY:(int)y andObject:(Sprite*)obj
{
[obj setPosition:CGPointMake(x,y)];
}
Now, I want to call above method, using following timer.
[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector() userInfo:nil repeats:NO];
What to set Here?
How to Pass arguments? (as per my knowledge - selector spec...
Hello Experts!
I am trying to do a POST towards a site which utilizes secure session with cookies.
Ofcourse this won't work with the code I have posted below. It keeps responding with a non-authorized message.
Is there any way I can use cookies in my code or at least simulate cookie usage?
NSURL *url = [[NSURL alloc] initWithStri...
I'm having a problem with a Cocoa application I am writing. It has to parse a timestamped file that is updated every hour, and during testing it keeps crashing consistently at around 11:45 PM due to a segmentation fault. I'm assuming I must be messaging an object that has been deallocated. What tools are provided with the Xcode install t...
I am looking to make a custom window which would look something like this (never mind the quick photoshop):
The main problem I have is not to make the window transparent (although I guess any info is welcome!), but that I want to be able to click only on the visible part of the buttons. For example, if I click just outside the top lef...
In my iPhone app I provide users with a view of industry news items. I get this list as an xml file from my server. Parsing and inserting the xml data into my Core Data repository is a no brainer, but there are a few cases where I might get duplicate news item entries.
I thought a good solution would be to insert all the updates when I ...
Hello! I have a Core Data model setup like so:
Blockbuster Entity
To-Many relationship to DVD entities.
DVD Entity
title attribute (string)
To-One relationship to a parent Blockbuster entity
A single Blockbuster can have multiple DVD's inside of it (To-Many). Each DVD can only be part of a single Blockbuster (To-One).
There ar...
Hello,
I am trying to build an RSS reader for the Tom's Hardware website.
I have an error when I try to load an URL into an UIWebview from an RSS link.
Here'is my code:
- (void)viewDidLoad {
[super viewDidLoad];
if (self.url != nil) {
NSURL *requestUrl = [NSURL URLWithString:self.url];
NSURLRequest *requestObj = [NSURLRequest...
In my iPhone app, views will often load slowly when transitioning, like if a user clicks a button on the Tab Bar Controller. This happens more if the phone is low on memory. It doesn't really come up on 3GS phones, but it's a big problem on 3G phones.
I suspect that I'm not following some best practices for creating UIViewControllers. I...
When I try to print an integer value to the console that is retrieved from an NSManagedObject, it displays a 6 or 8 digit value (the object ID?). However, if I use the debugger 'Print Description to Console' is shows up as the single digit value I expect.
For example, I assign the object 'sequence' to an NSInteger and then display using...
Or, what is the opposite of +(void)initialize?
Here's my situation:
I have a class Unit, whose -(id)initWithName: function takes data from a global NSDictionary, which is created lazily, defined in the Unit.m file as:
static NSMutableDictionary *unitLibrary = nil;
Where do I call [unitLibrary release]?
...
I am having a terrible time trying to do something that should be easy. I have a NSNumber value of 32025.89 seconds. I need to represent that in Hours, Minutes, Seconds. Is there a method that spits that out? I can't seem to find a proper formatter.
...
I was just writing some exploratory code to solidify my understanding of Objective-C and I came across this example that I don't quite get. I define this method and run the code:
- (NSString *)stringMethod
{
NSString *stringPointer = [[NSString alloc] initWithFormat:@"string inside stringPointer"];
[stringPointer release];
...
Hi all,
I'm a C++, Java developer and I want to program for Mac in something "nicer" than Objective-C.
I know Java Swing can mimic the MacOS X UI, but a Java Swing program is not a Cocoa first citizen. Also I know that I can use Qt in C++ or Jambi in Java to use the Qt toolkit that performs Cocoa calls but, though that is not a bad ide...
Can anyone give me the example code that I can use to first present a modal view controller, then dismiss it? This is what I have been trying:
NSLog(@"%@", blue.modalViewController);
[blue presentModalViewController:red animated:YES];
NSLog(@"%@", blue.modalViewController);
[blue dismissModalViewControllerAnimated:YES];
...
Does this method work well for developing apps in windows?
Any testimonial or examples of apps developed in java using xmlvm?
Looking for the best free method to develop apps in windows.
Thanks.
...
I'd like to give a UIButton in my app a continuous "pulsing" effect where it animates through a series of images and then reverses back through these same images. I've found examples of UIImageViews using their animationImages property, but all I've found for UIButtons is animating changing their alpha.
The UIView method setAnimationRe...
I need help trying to configure in a UIViewController, the keyboard : (a) not hovering over both UITextfields, so the scroller should be positioned correctly; and (b) When the user touches the background the keyboard disappears.
I havent tried (b) yet but im trying (a) and the code I got from googling around didn't give me the desired e...