I've created a new View-based Application in XCode.
In the ViewController, the only code that I've modified looks like this:
- (void)viewDidLoad {
[super viewDidLoad];
UIView *newView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
newView.backgroundColor = [UIColor redColor];
[self.view addSubview:newView];
[CATransact...
What I want to do seems pretty simple, but I can't find any answers on the web. I have an NSMutableArray of objects, let's say they are 'Person' objects. I want to sort the NSMutable array by Person.birthDate which is an NSDate.
I think it has something to do with this method:
NSArray *sortedArray = [drinkDetails sortedArrayUsingSelect...
I'm trying to draw a shadow under the bottom edge of a UIView in Cocoa Touch. I understand that I should use CGContextSetShadow() to draw the shadow, but the Quartz 2D programming guide is a little vague:
Save the graphics state.
Call the function CGContextSetShadow, passing the appropriate values.
Perform all the drawing to which you ...
I've been reading that if I have something like this:
@property (nonatomic, assign) UIView *anView;
Then I don't have to care about memory management. I don't have to do [anView release] in the -dealloc method.
Why?
"assign" just tells the compiler: "Hey man, this property does not retain whatever anyone assigns to it". And then you...
I managed to design a fairly decent launch image/default.png. But I noticed that it just flashes for a second then goes to the UI. Is it possible to code the launch image and make it dynamic? Remaining on screen until the user touches it or a button. Or is this something one would definitely not want to do?
Thanks,
~D1~
...
As a newcomer to iPhone development and Objective-C in general over the last few weeks I have come across numerous mentions of 'Toll free bridges' between CF and NS frameworks.
One particular example would be CFStream and NSStream.
Does a resource exists documenting all of these bridges and how to use them ? Is it just as simple as cas...
I want to write an NSOutputStream to a server with apple's sample code:
NSURL *website = [NSURL URLWithString:str_IP];
NSHost *host = [NSHost hostWithName:[website host]];
[NSStream getStreamsToHost:host port:1100 inputStream:nil outputStream:
[oStream retain];
[oStream setDelegate:self];
[oStream scheduleInRunLoop:[NSRunLoop currentRu...
Like I understand, @synthesize actually is generating the Getters and Setters. But what's @property then doing? Is it just setting up the parameters for that cool @synthesize magic function?
...
I have a readonly BOOL property. What is dominant naming pattern here?
Background: for plain old method declarations, the accepted pattern
- (BOOL)isEditable;
- (void)setEditable:(BOOL)flag;
In a @property world, that would typically be expressed as
@property(getter=isEditable) BOOL editable;
However, there are examples to the con...
Hello, I have a question dealing with UIButton and it's hit area. I am using the Info Dark button in interface builder, but I am finding that the hit area is not large enough for some people's fingers.
Is there a way to increase the hit area of a button either programmatically or in Interface Builder without changing the size of the I...
Hello again. I am wondering if anyone has used the userInteractionEnabled method on a UILabel to allow the label to act like a button (or just to fire off a method). Any help would be greatly appreciated. Cheers!
Update (4/30/09 @1:07pm) Clarification: I have a standard InfoButton and next to it I want to place a label with the text...
In reference to this related question on stackoverflow:
If you create a constants file, how do you "link" to it in your target, so you don't have to
#import "Constants.h"
in every file you use constants?
...
As my question in the subject above states, what requirements do you typically have to meet in order to say "Ok, I need encodeWithCoder: and initWithCoder: instantiation for this"? Typically you can write object state to NSUserDefaults, so I'm curious when do you experts decide to use one vs the other?
...
Hi hi. Does anyone know of a quick way to dump the standardUserDefaults of NSUserDefaults via NSLog? This is what I have:
NSLog(@"NSUserDefaults dump: %@", [NSUserDefaults standardUserDefaults]);
But it returns:
NSUserDefaults dump: <NSUserDefaults: 0x50b520>
...which is not quite what I'm looking for. I'd really like to have ke...
Hi, I'm trying to use NSNumberFormatter to round a number to 5 decimal places in an iPhone app, but [formatter stringFromNumber:] always returns strings rounded to 0.001 (3 decimal places). What am I doing wrong??? Many thanks.
formatter = [[NSNumberFormatter alloc] init];
[formatter setNumberStyle:NSNumberFormatterDecimalStyle];
[forma...
I have a main view that manually creates a UIViewController (not a UINavigationController) and adds that controller's view as a subview.
The subview then dismisses itself via [self removeFromSuperview]. I understand this releases the view, so that is good, however I now want to get also get rid of the UIViewController I alloc'ed immedia...
Is it possible using the iPhone SDK to grab a frame from a video in iPhone and save it or use it in any way in the application? Does the SDK give any control over the video other than play/stop or maybe access to the binary data of the video?
Also is it possible to know the time at which the user stopped watching the video (i know in SD...
If I wanted to modify or add my own extensions to C, and add them to the GCC C compiler, what would I need to do? I do not want to propose changes to the language, I want to know how the C compiler actually works.
I've had a look at the source code to GCC and it looks as if Objective-C is implemented as a simple parser that generates co...
Actually, if you use a method with "new", "create", "alloc" or "copy" in it's name, then you are responsible for releasing the object that is returned to you. BUT: Why do these methods make an call to -autorelease? Wouldn't this result in "over-releasing" the object?
Lets say I get that object from such a method, and then I call -releas...
As far as I know, only the "convenience" methods return created objects with an -autorelease, so that the receiver is not responsible for the memory of that object. But because Apple says that when you use a method that has a name consisting of "new", "alloc", "create" or "copy", you're responsible for releasing the object that method re...