I have two views, the parent view opens a pop over that has a child view.
In child controller
@property (nonatomic, assign) ParentController *parent;
In parent controller
ChildController *child = [[ChildController alloc] init];
child.parent = self;
My question is in the dealloc method of the child controller, do you set self.parent = ...
I have an NSString with the value of
http://digg.com/news/business/24hr
How can I get everything before the 3rd level?
http://digg.com/news/
...
Hi guys
I used the code to try set the label text but its not working. I though maybe I forgot to connect the outlet with the label, or i connected the wrong outlet but they were ok once I checked them. Made sure the xib was saved.
.m
@synthesize nameLabel;
@synthesize infoLabel;
-(void) updateUI
{
nameLabel.text = @"test1";
infoLabe...
I am trying to compile some code where I have a class called Card. It has a method called
-(void)setSuit: (NSString *)suit
It is an instance method, but when I say
[Card setSuit:@"Diamonds"]
Xcode says: warning: "Card" may not respond to method +setSuit
And my program doesn't work. I think that Xcode thinks setSuit is a class m...
if I have a property such as
@property (nonatomic, retain) NSArray *myArray;
and then I set it as follows
[self setMyArray:[[NSArray alloc]init]];
do I have a retain count of 2?
When I release it in my dealloc method will there still be a retain count of 1?
...
Hello everyone,
I have a NSMutablArray of UIButtons. I want to index through them and set their images based on other data. The problem I'm having is finding a loop to pass them all through (I don't want a long list of ifs).
for (UIButton *theButton in theButtons) {
A loop will not work. What other way is there to be able to set i...
I hope this has a technical (rather than a religious) answer, but I wonder if I should use Objective-C or C++ to create an OpenGL ES Application on the iPad?
As the ultimate goal would be to compile it on Windows and OS X as well, I'm inclined to use C++ (and only use ObjC for the stuff that I have to: App Delegate etc.), but I have zer...
Slightly related to my other question, how do I execute JavaScript from an Obj-C/C++ program on OSX? (I think JavaScript will allow me to do what I need to, even though AppleScript doesn't. According to the Photoshop documentation anyway.)
I need it to be able to interact with Photoshop.
...
Hi all,
Sorry but I found no clear answer on that.
I have an iphone app with a tab bar and a UINavigationController in each tab.
The interface is built with Interface Builder, and in the first tab there is a UITableView.
I have prepared the xib with main view (A) containing a table (T) and an image (IMG) background behind (image as subv...
Occasional reader and first time question asker, so please be gentle :)
I am creating a Managed Object (Account), that is being passed into a child view controller where its being set in a property that is retained.
Account * account = [[Account alloc] initWithEntity:entity insertIntoManagedObjectContext:context];
AddAccountViewControl...
I started a new project with XCode and I have set up the subversion repository. For some weird reason, in this project the "Add to repository" menu items are not working, both in the main menu and by right clicking a file. If the file is in the repository I can do all the usual things. Newly added files do not show with a question mark e...
Hi,
I'm trying to compare two strings with each other on the iphone, but the IF statement is always false. Here's my code:
NSLog([[UIDevice currentDevice]uniqueIdentifier]);
if ([[[UIDevice currentDevice]uniqueIdentifier] compare:[[NSUserDefaults standardUserDefaults] valueForKey:@"id"]] == NSOrderedSame) {
//OK
NSLog("Do stuff...
Hi I have this code:
NSInteger *count = [monLessonArrayA count];
for (i = 0; i < count; i++) {
arrayVar = [monLessonArrayA objectAtIndex:i];
}
I get an error saying i is undeclared, how can I set the objectAtIndex to i so I can loop through increasing it each time?
Thanks.
...
Hi
I have a bunch of NSStrings in a NSMutableArray. I have added them to the array and now I want to loop through the array, getting each object in it (the strings) and set them to a common value @"No Lessons".
This is how I have the loop so far: But how can I get the object then set it? Currently its fairly simple, just getting loopin...
What Objective-C datatype would you recommend to store the following:
Position - The position for an object on the screen
Direction - The direction of the object
Velocity - Well, the velocity of the object
Bounds - The allowed bounds for where the object is allowed to be.
Thanks!
Björn
...
How can I get the year/month/day of a NSDate object, given no other information? I realize that I could probably do this with something similar to this:
NSCalendar *cal = [[NSCalendar alloc] init];
NSDateComponents *components = [cal components:0 fromDate:date];
int year = [components year];
int month = [components month];
int day = [co...
Hi all,
I have a UITableView and its data gets refreshed from a server connection. For the UITableViewcell, I have layout some labels across the row. So it can consider as a grid with UILabels(total no of labels = table rows * table columns).
When the data gets refreshed I have added an animation for the UILabel to highlight the table ...
How would I be able to get the OSX version in objective-c? I would like to avoid using shell commands. E.g "10.5" or "10.4"
...
Hi
How can I handle different views in XCode?
Let's say I want to show a different view when the user press a button.
UIViewController *viewSettings;
[viewSettings initWithNibName:(NSString *)@"SettingsViewController" bundle:(NSBundle *)nil];
This code don't work. The app crashes.
I have updated my XCode to the new version. How can I ...
I was wondering what I needed to know in terms of C to move onto Objective-C. I would be uber-grateful if you could let me know what you think is sufficient to move on Objective-C.
Thanks,
~Daniel
...