I'd like to override UILabel's setText method but I'm not sure that A) it's possible and B) if maybe there's a better way to achieve what I'm trying to accomplish.
I have a subclass of UIView that has a UILabel property as one of its subviews. I'd like to know when the UILabel's "text" property changes so I can adjust the size of the r...
So some where i have a leak which is related to deleting an object under certain circumstances.
Premise:
- I have an NSMutableArray of Tree objects (a Tree object knows how to draw itself).
- I have a reference pointer (Tree *selected) which basically points to whatever tree i last touched.
- Note that the *selected pointer is a weak r...
I'm making a program that has a lot of constants. I decided to put them all into a separate class and I'm importing it by the classes that need it. The files look similar to this
// Constants.h
extern const int baseCostForBuilding;
extern const int maxCostForBuilding;
// etc
// Constants.m
const int baseCostForBuilding = 400;
const int...
My code downloads images asynchronously using InternetImage in the tableview: cellForRowAtIndexPath: method by initializing a IntentImage with initWithURL and calling downloadImage. This code runs perfectly after scrolling down to a new cell UITableViewCell in the UITableView, but not before, even though the URL is correct in both cases....
I'm trying to make a color chooser using an NSPopupButton, and at the bottom i'd like a separator and a "Custom…" option. Is it possible to load the colors from array, then tack the separator and "custom" item on bottom? if so, how?
Thanks!
...
I am attempting to read audio data via AudioQueue. When I do so, I can verify that the bit depth of the file is 16-bit. But when I get the actual sample data, I'm only seeing values from -128 to 128. But I'm also seeing suspicious looking interleaved data, which makes me pretty sure that I'm just not reading the data correctly.
So to be...
I am very new to objective-c and having a problem to initialize an object in view controller. The problem I am having is that when setTemp method is called, "0" is printed on the screen instead of the value of cTemp I would like it to be. Can anyone help me on this problem?
Below are excerpts of the code I have.
SJT.h
#import <Founda...
how can i declare a global NSArray and then use it across my app?
...
How can I set a key equivalent for a NSToolbarItem?
...
In Objective-C 2.0 we got the "dot" notation for properties. I've seen various back and forths about the merits of dot notation vs. message notation. To keep the responses untainted I'm not going to respond either way in the question.
What is your thought about dot notation vs. message notation for property accessing?
Please try to...
I have a NSString declared in my AppDelegate. I am trying to read/write that string from my View class but it's giving me error about getter/setter method not found.
Here's how i am accessing it:
MyAppDelegate *appDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
appDelegate.myString = @"test";
...
I'm trying to let a player tap, drag and release a card from a fanned stack on the screen to a 4x4 field on the board. My cards are instantiated from a custom class that inherits from the UIImageView class.
I started with the Touches sample app, and I modified the event handlers for touches to iterate over my player's card hand instead ...
I've been trying to implement a singleton for shared data in an iPhone app, and I've used both the macro found here:
link text
and I've tried transplanting the code from the macro to straight .h/.m files and I can Build and Debug just fine, but once I try to run instruments I get an immediate crash with no helpful information (before t...
Hi I have the following code:
- (IBAction)runTask:(id)sender {
NSTask *proc;
NSPipe *output;
NSData *data;
NSString *buffer;
proc = [[NSTask alloc] init];
output = [[NSPipe alloc] init];
[proc setLaunchPath:@"/bin/sh"];
[proc setArguments:[NSArray arrayWithObjects: @"-c", @"/usr/bin/otool -L /Applicatio...
Looking for some tutorials or documentation about the more advanced fine tuning of processor management in Objective C for programming in the Mac OS system. Things such as writing a process that works well with other processes and the way the Mac OS handles processes and processor scheduling.
...
I created a method to build URLs for me.
- (NSString *)urlFor:(NSString *)path arguments:(NSDictionary *)args
{
NSString *format = @"http://api.example.com/%@?version=2.0.1";
NSMutableString *url = [NSMutableString stringWithFormat:format, path];
if ([args isKindOfClass:[NSDictionary class]]) {
for (NSString *key in...
I've been trying out some of the view code from Erica Sadun's book "The iPhone Developer's Cookbook" and found some code I don't understand. Here's the code for a loadView method:
- (void)loadView
{
// Create the main view
UIView *contentView = [[UIView alloc] initWithFrame:
[[UIScreen mainScreen] applicationFrame]];
contentView.b...
How would I use this awk command:
awk 'NR>1{print $1}' string-to-modify
with NSTask? I already tried setting /usr/bin/awk as the launch path, 'NR>1{print $1}' as an argument, then the string to modify as another argument but all I get is this:
/usr/bin/awk: syntax error at source line 1
context is
' <<<
/usr/bi...
Ok, I know the answer to this question should be obvious, but I need a little push in the right direction.
I find myself writing a fair number of methods that follow the following pattern:
-(NSThing*)myMethod{
NSThing *thing = [[NSthing alloc] init];
// do some stuff with the thing
return thing;
}
My question is, how do I hand...
I'm working on a Cocoa app with the intention of using it on Windows and Linux using GNUstep. I've been avoiding Objective-C 2.0 features thus far, but I'd really love to start using at least properties. What Google seems to tell me (though I'm having trouble finding much on the subject) is that currently, no Objective-C 2.0 features wor...