Yet another C#/.NET guy trying to learn Objective-C with big dreams of making millions with an iPhone app :)
Ok, I'm sure this question stems from me being so used to static typed languages, and therefore am having a tough time adjusting, but here's my issue. Let's assume I have a class called MyObect:
MyObject.h
@interface MyObject :...
I've got this code:
Entry.h
#import <Foundation/Foundation.h>
@interface Entry : NSObject {
id object;
SEL function;
}
@property (retain) id object;
@property (assign) SEL function;
-(Entry*) initWithObject:(id)object selector:(SEL)function;
@end
Entry.m
#import "Entry.h"
@implementation Entry
@synthesize object;
@synt...
I want to know how to pass structures to another function and subsequently access that structure in the called function. I'm developing for the iPhone and the reason I'm using structs is so that I can eventually pass data as structs to a server being built in C.
Here's the structure:
struct userInfo{
NSString *firstName;
NSStri...
I have a window with an subclass of NSView in it. Inside the view, I put an NSImage.
I want to be able to rotate the image by 90 degrees, keeping the (new) upper left corner of the image in the upper left corner of the view. Of course, I will have to rotate the image, and then translate it to put the origin back into place.
In Carbo...
I am coming to Objective-C from C# without any intermediate knowledge of C. (Yes, yes, I will need to learn C at some point and I fully intend to.) In Apple's Certificate, Key, and Trust Services Programming Guide, there is the following code:
static const UInt8 publicKeyIdentifier[] = "com.apple.sample.publickey\0";
static const UInt8 ...
Hi, in this sample method/message:
-(void) setNumerator:(int) n {
numerator = n;
}
What does the (int) mean? It doesn't look like its casting to an int...
...
When do you and when dont you need the * symbol (which is because in objective-c all variables like NSString are pointer variables)?
For example when do you need to do "NSString *" instead of just "NSString"?
...
How do you write a method/message with multiple parameters?
EDIT: Like multiple parameters for a single method/message, I mean.
...
For example:
@interface Fraction: NSObject {
...
When wouldn't NSObject be used and is NSObject the ultimate parent class for all other classes?
Please feel free to correct me on any wrong terminology used.
...
What's the most efficient way to sort objects in an NSSet/NSMutableSet based on a property of the objects in the set? Right now the way I am doing it is by iterating through each object, add them to a NSMutableArray, and sort that array with NSSortDescriptor.
...
What sort of Objective-C runtime magic do I need to use to make it so a property for an object is always set to a value than its normal default. For example, UIImageView's userInteractionEnabled is always false, but I want to my own UIImageview subclass to always have userInteractionEnabled set to true. Is the same thing achievable wit...
I'm working through the tutorials in the "Beginning iPhone Development" book. I'm on chapter 4 and I'm getting the following compile error on the "if (segment == kShowSegmentIndex)" line:
error:expected ')' before ';' token
Here's my code:
- (IBAction)toggleShowHide:(id)sender{
UISegmentedControl *segmentedControl = (UISegmentedC...
I'm trying to implement a Save State for my iPhone App.
I've got a plist file called SaveData.plist and I can read it in via the following
NSString *pListPath2 = [bundle pathForResource:@"SaveData" ofType:@"plist"];
NSDictionary *dictionary2 = [[NSDictionary alloc] initWithContentsOfFile:pListPath2];
self.SaveData = dictionary2;
[dict...
I've only just started learning Objective-C but am interested in audio processing and editing software and would like to know where to find information on where to start.
It's early days yet so I'm just looking for inspiration.
...
I'm a total noob to iPhone programming, and I've run into an exception being thrown that I just can't wrap my head around.
Background: The error is happening in a custom subview, and occurs immediately upon loading the program. I'm getting an exception thrown in the overridden drawRect method. The code throwing the error follows:
- (vo...
I think one of the best ways to learn a new programming language is to dive into source code and see how experienced coders write. I've found this kind of question asked here on Stack Overflow for other languages, but none targeted at Objective-C. The closest I've found is this question about good-looking Cocoa user interfaces, but I'm...
Hi All,
I have a URL string in the following format.
http://myserver.com/_layouts/feed.aspx?xsl=4&amp;web=%2F&amp;page=dda3fd10-c776-4d69-8c55-2f1c74b343e2&amp;wp=476f174a-82df-4611-a3df-e13255d97533
I want to replace & with & in the above URL. My result should be:
http://myserver.com/_layouts/feed.aspx?xsl=4&a...
I'm new to Objective-C. I have created a textview in code, that limits its text to 25 characters. When the user wants to add more than 25 characters in the textview it shows an alert view... Now the problem is, when I click the done button it again shows the alert view. Can anyone tell me how to solve this?
...
I have an area of a Window (in my MainMenu.xib) which I'd like to populate dynamically with unrelated "views" such as an NSTable, IKImageBrowserView etc. at different points of time depending on some user-selected criteria.
How do I define this area of the window such that it can be "replaced" with different views?
How do I attach a ta...
i have added a splash screen to my application by adding Default.png.
the splash screen works fine in the simulator but not showing on real device
...