I am trying to obtain localized strings for the English language (in en.lproj/Localizable.strings) for use as default values when the localized string for the user's preferred language is not found.
I want to pass in that default value to this method:
[[NSBundle mainBundle] localizedStringForKey:key value:defaultValue table:nil]
But...
If I declare a pointer variable in this fashion:
NSString *foo;
And then somewhere later in my code do something such as:
foo = @"bar";
Is that ultimately taking my NSString, creating a new copy in memory with an additional string, then deleting my initial string? Would foo be better off as an NSMutableString?
...
I implemented the following code:
NSURL *url = [ NSURL URLWithString:[ NSString stringWithFormat: @"http://www.google.com/search?q=%@", query ] ];
NSURLRequest *request = [ NSURLRequest requestWithURL: url ];
I want to extract the body from what I receive back from the url above. I attempted:
NSData *data = [request HTTPBody];
The ...
I'm banging my head up against Cocoa and Xcode, and have been for months. I never seem to be able to get away from the tutorials, which are often incomplete, or Apple developer documentation, which is sparse on samples. I've watched videos, downloaded source code and asked developers for help. I still feel like I haven't gotten that audi...
I'd like to have a similar ellipse as the Mail app in my iPhone app. A screenshot just for reference is here: http://dl-client.getdropbox.com/u/57676/screenshots/ellipse.png
Ultimately I'd like the ellipse with a numerical value centered in it. Is it best to use a UIImage for this task? Perhaps less overhead to draw it with Quartz? If i...
I'm trying to use a UITableViewController (delegate & dataSource for the view) to display a simple table read from a Plist. The Plist contains a NSDictionary which itself contains several NSDictionary objects that represent objects used in my application.
The rest of the code looks something like this (simplified):
- (void)viewDidLoad ...
All of the examples I can find of setting up a notification look like this:
[nc addObserver:self selector:@selector(keyboardWillShow:) name: UIKeyboardWillShowNotification object:nil];
where object is always being set to nil. object is the notificationSender, which is defined thusly in the documentation:
"The object whose notification...
Hi, I want to implement index feature in UITableView as is in the standart contacts application.
Is there an elaborate tutorial how to achieve this goal? What is the right way to do so?
Data in my table is sorted alphabetically and when a user presses on a certain letter in the index I want to scroll to the same letter in the table.
H...
Hopefully, this question isn't a dumb as I fear it sounds, but it may still be pretty dumb.
I'm new to Objective-C, and Cocoa. In fact, I'm completely new to C in general. I'm trying to implement an iPhone game using Cocos2d-iPhone. It's a game I've made before in Flash, so I thought it would be a nice way to lean Objective C, cocoa an...
There's a joke in there somewhere.
Anyhoot. In the following code, the setForceVector method has no actual effect on the value of member it's attempting to change. By checking the log, I can see the function is being called (by another object handling to a touchEvent).
I've used NSLog to check that the forceVectorfromControls is actu...
I've got 4 different iPhone/Cocoa/Core Animation/Objective-C books in front of me, along with numerous sample code from the web. Yet somehow I still feel like I'm missing some fundamental understanding of how drawing works in Quartz 2D.
Is drawRect() meant to simply be a hook in which to execute your drawing code? Or is this method s...
Specifically, I'm trying to deal with the bug where, pre-2.2, UINavigationControllers with translucent navigation bars affect their subviews as if they weren't translucent; i.e. they position them too far down.
So I need to know what to test in order to perform "if this build is against a pre-2.2 SDK, fix the view positions."
...
Hi, I was looking forward to find a cause for my application being crushed at some point and I found out that methods of UITableView are being called before or at the same time as viewWillAppear is called.
In viewWillAppear I have code that is initializing number of rows in each section but numberOfRowsInSection is being called before I...
Hi,
I cannot find a problem in my code. At some point it is throwing an exception. When I am showing a view and after that it is being disappeared (going to another view) and after that entering the previous view again it is throwing an exception which I cannot understand.
And when I am scrolling my tableview sometimes an exception is b...
I have a UITableViewController inside of a UINavigationController.
I want to have a UIView appear over the top of the table view but not susceptible to the scrolling of the table view.
I.e. if the table view is scrolled, the UIView should remain in the same position relative to the screen, rather than relative to the table view. It sh...
Hi, when I try to release a dictionary I get an exception.
Here is my code:
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
if (!tableDataDictionary)
{
DebugLog(@"initializing tableDataDictionary");
tableDataDictionary = [ [NSMutableDictionary alloc] init];
}
}
-(void)viewWillDisappear:(BOOL)animated...
I have a grouped table view that utilizes two different custom table cells.
When i scroll through the table so that one (or more) of the cells goes either above or below what is visible those cells become blank. When i scroll back up (or down) to view these cells they are still blank. Why is this? The cells showed the appropriate con...
I have a property that changes to invalid as I move between viewDidLoad and viewWillAppear. I have no idea why that happens.
I have a helper class that gets the path to my database. I alloc this class in the app delegate. RootViewController gets a reference to the appDelegate like this:
//inside .h file
@interface RootViewController...
Hi,
When I am scrolling my table way too down, application crushes. And I cannot find where the error in code is.
Here is my code:
NSMutableDictionary *tableDataDictionary;
NSInteger *rows_in_section;
-(void) initView
{
if (!tableDataDictionary)
{
tableDataDictionary = [ [NSMutableDictionary alloc] init];
}
[sel...
My subclass of UIView handles touch events and updates internal values as touches begin and as tracking occurs.
My view controller loads this custom view on screen. What's the best way to set up my view controller to listen for the value changes of my custom control?
...