When I need to load a view programatically I do the following:
MyController* myController = [[MyController alloc] init];
[[NSBundle mainBundle] loadNibNamed:@"myNib" owner:myController options:nil];
// use my controller here, eg. push it in the nav controller
This works fine, but my controller's viewDidLoad is never called. So I resor...
I've a Core Data application. In the producer thread, I pull data from a web service and store it in my object and call save.
My consumer object is a table view controller that displays the same.
However, the app crashes and I get
NSFetchedResultsController Error: expected to find object (entity: FeedEntry; id: 0xf46f40 ; data: ) in s...
this way works:
type1ViewController *viewController = [[type1ViewController alloc] initWithNibName:@"Type1View" bundle:nil];
viewController.parentViewController = self;
self.type1ViewController = viewController;
[self.view insertSubview:viewController.view atIndex:0];
[viewController release];
but this way gives me the error, "request...
You know how Mario just keeps running to the right when you press and hold the right-button on the D-Pad? In the same manner, I want my UIButton to continuously fire its action for the duration that it is held down. Is this possible for a UIButton? If not, is this possible to do with a UIImageView by overriding a touch handling method in...
I have a UITextView on top of a UIView. They are in a PageScrollView. The user can swipe anyhere outside of the UITextView and flick over the next page (view). I'd like the user to swipe on the UITextView and flick over the next view as well.
The UITextView scrolls vertically when there is to much text, which the user can swipe and...
I have some UIImageViews that are nested in UIViews, which group them together. They're owned by an view controller. As soon as the -viewWillDisappear method is called, I want to remove those UIImageViews with their UIViews alltogether, so that the memory gets freed up.
I call -release on the UIViews that contain the UIImageViews as sub...
I want to display an ABPeoplePicker with only people who have a geographic address defined.
So I create an addressBook and remove people that dont have an address:
addressBook = ABAddressBookCreate();
NSArray *peopleList = (NSArray *)ABAddressBookCopyArrayOfAllPeople( addressBook );
NSLog(@"There are %d people in addressBook", ABAddres...
Well, for integers I would use NSNumber. But YES and NO aren't objects, I guess. A.f.a.i.k. I can only add objects to an NSDictionary, right?
I couldn't find any wrapper class for booleans. Is there any?
...
I'm writing an iPhone application that provides a button to call a phone number. I'm using code like the following to dial the number using a tel: URL in the usual way:
NSURL* contactTelURL = [NSURL
URLWithString:[NSString
stringWithFormat:@"tel:%@",
...
Hello,
I was going through some code that I downloaded off the internet (Got it here)
I am confused with this line of code... What exactly is it doing?
#define N_RANDOM_WORDS (sizeof(randomWords)/sizeof(NSString *))
Here is the array of "randomWords":
static NSString *randomWords[] = {
@"Hello",
@"World",
@"Some",
@"Random",
@"Word...
I have made sure that all superviews of my customized UIImageView and the UIImageView itself have userInteractionEnabled = YES;
Also in the nib all views and subviews have userInteractionEnabled = YES;
But for some reason, these get never called when I click on the UIImageView:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent ...
Instruments tells that there are "misaligned images" which are animated by core animation. What does that mean?
UPDATE: I've seen that in Instruments.app > Core Animation.
...
I guess that the "# Net" column is the most interesting, although I don't really understand what that's supposed to mean. Total number of currently allocated objects? It changes all the time, even if I don't do anything.
Are there any good "rules of thumb" to see if there is an memory leak?
...
Hi,
Currently i create 2 views and on the first view, there is a next button, upon clicking it, it will goto the second view.
Then in the second view, i set some value in the label and when i click back, it will go back to the first view.
Problem: now i am back in the first view, if i click the next button again, the label value i s...
I am a complete newbie to XCode, so I have been climbing the Quartz2D learning curve. I understand that a view's drawRect method is called whenever a refresh of the view's graphics is needed, and that the setNeedsDisplay method activates a redrawing.
But what I can't find is a clear explanation of the relationship between the graphics...
I'm using an IBoutlet to get a reference to a Sub-View I added to the main View in the interface builder but since this won't give me access to drawRect: I won't be able to get a context to draw on. Is there anyway I can still get the graphics context so I can draw on the sub view? How would I go about this?
...
The following code creates me an array of all my contacts in my address book by first name and last name. The problem is, I have one contact that keeps showing up with an empty first name and last name. I can't find that contact in my actual address book. Can anyone suggest how to debug this to figure out the source of the mystery ghost ...
I've read in several books... and online... about immutable and mutable strings.
They claim "immutable strings" can't be changed.
(But they never define "change".)
Which of these NSStrings could be changed without using NSMutableString?
The string contains "catfish"... and I later try to change it to "cat".
(Same letters, just shorter....
The following concerns an iPhone app.
I want to use a singleton to handle an asynchronous URL request. I've got that covered but what is the best coding practice way to tell the singleton where to send the response when it is received? I need the response to be returned to the class which originally called the singleton.
Could I pass a...
My RootViewController contains a table view and a navigation bar. Upon tapping a row, another view controller is pushed to the stack, namely SecondViewController. If I click the Back button, SecondViewController is popped out of the stack, but the parent view controller's data is out of date.
How could I reload RootViewController's data...