I am just learning objective-c but can't figure out whats wrong with my code
Code:
NSMutableDictionary *myDic = [NSDictionary dictionary];
[myDic setObject:[NSURL URLWithString:@"http://www.apple.com"] forKey:@"Apple"];
...
Hi All,
I'm writing a plugin for an application. I cannot derive from NSApplication
as it is a third party application. I can get the callback in my plugin when any key is pressed. But I will not know what key is pressed. So is there any call in Cocoa to find the last key pressed when I get the callback? I only have NSView object.
Any...
Hi all,
I am trying to draw custom shapes in iPad application. I am using UIBezierPath for drawing which is available for 3.2 onwards. My question is whether it is good to use this class or should I go to the core graphics? Is there any difference between uibezierpath and core graphics drawing related to performance?
...
// myClass.h
@interface myClass : NSObject {
int variable1;
}
- (int) addOne: (int)variable1;
//myClass.m
- (int) addOne: (int)variable1{
variable1++;
}
My question is: will [myClass addOne:aNumber] add 1 to aNumber or will it add 1 to the value of the ivar variable1?
...
I've got an enumeration in my game. A simple string message with an appended PacketType is being sent with the message (so it knows what to do with the message) over GameKit WIFI connection. I used Apple's GKRocket sample code as a starting point.
The code itself is working fantastically; I just want to understand what the line with CF...
making a game like 'doodle jump' requires opengl or core animation is just enough? which is the poit from where one should consider using opengl?
...
Hi,
I have a UIBezierPath that I need to take a list of points from.
In Qt there is a function called pointAtPercent that would fit my needs but I can't find anything equivalent in Objective-C.
Any one knows how to do that ?
...
Hi there,
I have an algorithm for creating the sieve of Eratosthenes and pulling primes from it. It lets you enter a max value for the sieve and the algorithm gives you the primes below that value and stores these in a c-style array.
Problem:
Everything works fine with values up to 500.000, however when I enter a large value -while run...
See the code here
@interface StaticView : UIView {
Properties *prop;
}
@property (retain) Properties *prop;
@end
and i am attaching this view via code
[super viewDidLoad];
StaticView *sView = [[StaticView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
sView.prop.glowIntensity = 0.85f;
[self.view addSubview:sView];
but i...
If I have an NSString that is initially:
"ABCDE*FGHI"
How do I make it turn into
"FGHI"
In other words, everything from the asterisk onwards is kept.
Likewise, how would I turn it into:
"ABCDE"
(everything up to the asterisk is kept)
Thanks
...
I have a very simple model with two objects: Name and Category. One Name can be in many Categories (it's one way relationship). I'm trying to create 8 Categories every with 8 Names. Example code:
NSMutableArray *localArray = [NSMutableArray arrayWithObjects:
[NSMutableDictionary dictionaryWithOb...
Hello
I have converted an iPhone application using the wizard like thing in XCode into a universal app.
It builds fine but obviously looks a bit rubbish in some areas :)
I need to load nibs according to which device is being used. I dont wish to create my view controllers using initWithNib as I already have code to create the control...
Right, to begin my question, here's some screenies of the problem already solved by the Spotify app:
Spotify's Step 1: Standard UISearchBar not in editing mode.
Spotify's Step 2: UISearchBar now in editing mode. Search term entered. Cancel button slides in from the right, and the clear button (grey x) appears.
Spotify's Step 3: Ca...
I'm trying to write an app which contains a table view with three cell, one custom cells and two "standard" cells
I have created a "custom cell" to be able to view a picture together with a subtitle in it. I would like to have the same look of the cell as a standard "UITableViewCell" but cannot figure out how to get the default position...
NSString *myString = @"Hello";
NSString *myString = [NSString stringWithString:@"Hello"];
I understand that using method (1) creates a pointer to a string literal that is defined as static memory (and cannot be deallocated) and that using (2) creates an NSString object that will be autoreleased.
Is using method (1) bad?
What are t...
Hi All
I am using the TTMessageController class for compose mail.There is only 'To' recepients Field in this class. I added the Cc Field in it. I have used this code:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
_fields ...
Hello everyone,
I am curious to know if you can loop an NSThread for the iphone sdk. I have learned that instead of using NSTimers which do run off of the main UI, I can use NSThreads to run actions in the background. Most of my NSTimers have the "repeats:" to YES, thus I need to know if NSThreads can be looped.
Thanks
Kevin
...
I would lean towards
if (object == nil)
but I've noticed in some tutorials the use of
if (nil == object)
Is this just a style thing, or is there some justified rationale for using either format?
...
Hi Guys,
I want to append the string into single varilable using stringWithFormat.I knew it in using stringByAppendingString. Please help me to append using stringWithFormat for the below code.
NSString* curl = @"https://invoices?ticket=";
curl = [curl stringByAppendingString:self.ticket];
curl = [curl stringByAppendingString:@"&apikey...
Hi,
I've been trying to figure out how to make a powder toy style game on the iPhone. My problem is how to draw pixels to the screen. From what I've read, OpenGL is better for games as it is faster/hardware accelerated, but there is no method to draw pixels directly to the screen. Apparently drawing pixels to an off-screen frame buffer ...