Today I encountered something strange: I tried to put a utility method into an Utility class as a class method, so that I can simply call that method to generate me an convenient UIView with no hassle (not the imageNamed method but the other, much more complex one). It was horrible. The performance was so incredible bad. Then I made an i...
Hi, I have the following piece of code from a book.
There is this function loadPrefs where the NSString *userTimeZone is being released before the end of the function.
Why? The string was not created with alloc and I assume that the stringForKey function returns an autoreleased NSString. Is this an error or am I missing something? Is ...
I would like to implement an observer pattern in Objective-C where the observer implements an interface similar to SKPaymentTransactionObserver and the observable class just extends my base observable. My observable class looks something like what is below. Notice I'm making copies of the observers before enumeration to avoid throwing ...
UIActionSheet positioning is not centered when I open it in landscape mode. If I set bounds or change the frame. The contents inside the UIActionSheet which is a subview changes but the actual sheet remains in the same place which looks very awkward.
How do I move the UIActionSheet along with it's subview to the center of the screen?
...
How can I create a modal window in my iPad app similar to the one shown on Apple's website for composing messages in Mail.app?
Example:
Thanks!
...
I'm trying to animate a GIF and I hit a roadblock. I have an example of what I'm trying to do that uses the individual frames of the GIF and setting the animationImages property of a UIView. However in my project, the thing I want to animate is drawn using Layers. I'm looking for a quick and easy way to animate the frames without introdu...
I am trying to get the contentOffset property of a UIScrollView in the middle of a setContentOffset animation. Note I am not using the animated property of the method, but instead enclosing the setContentOffset operation within a UIView animation block so I can have finer control.
When I try to read the value of contentOffset in the mid...
This topic has been scratched once or twice, but I am still puzzled. And Google was not friendly either.
Since Quartz allows for arbitrary coordinate systems using affine transforms, I want to be able to draw things such as floorplans using real-life coordinate, e.g. feet.
So basically, for the sake of an example, I want to scale the v...
Hi,
I've defined a view controller with an array as one of its properties, and set the array with an allocated and autoreleased array.
After I push the view for display I release it.
By watching the leaks tool I see that every time that I pop the view I suffer from leakage.
I tried to release the properties explicitly, immediately afte...
I am using the code:
{
randomstatus=0;
msg=[[NSString alloc]initWithFormat:@"Good job, do you want to continue?"];
UIActionSheet *actionSheet=[[UIActionSheet alloc]initWithTitle:msg delegate:self cancelButtonTitle:@"No" destructiveButtonTitle:@"Yes" otherButtonTitles:nil];
[actionSheet showInView:self....
I'm looking to have my main view shrink to reveal the next view in the same way the Facebook app's views shrink when you press the top-left button. I already have it working with one of the included animations like this:
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAn...
I'm loading a view like this:
if(commentSubmissionView == nil){
commentSubmissionView = [[CommentSubmissionController alloc] initWithNibName:@"CommentSubmissionView" bundle:nil];
}
[self.view addSubview:commentSubmissionView.view];
viewDidLoad and viewWillAppear in commentSubmissionView do not fire. Is there something else I n...
How to do like that? I don't know how to do..Help me.
...
I have a need to make a UITableView only display whole cells at the top of the cell, so when the table is moved or scrolled it should animate to make a whole cell visible at the top of the table if it has happened to stop with a cell partially off the top. This can be easily done using visibleCells and scrollToRowAtIndexPath methods of U...
Is there some way to have a keyboard of type UIKeyboardTypeNamePhonePad start in phone number pad mode rather than alphabetic? The keyboard works well for what I need but I'd like it to start in the "other" mode since that is more likely what the user will enter.
...
I've build a static library working nice in a Cocoa Touch environment. Now I'd like to compile it also for Cocoa.. Can I have a single XCode project with different sdk targets? Is there some resource out there able to give hints about best the practices in this (and other) sense?
...
Hi, In the following piece of code (from a book) data is an NSDictionary *data; defined in the header (no property).
In the viewDidLoad of the controller the following occurs:
- (void)viewDidLoad {
[super viewDidLoad];
NSArray *keys = [NSArray arrayWithObjects:@"home", @"work", nil];
NSArray *homeDVDs = [NSArray arrayWithOb...
Hi, I'm looking to create an interface where the user can navigate through large volumes of images. Each image has a thumbnail of 128x128 that I wish to display and will be kind of similar to coverflow in operation.
I have this all working in principle but am becoming stuck when navigating through content at speed. The interface begins ...
I have designed a view with a toolbar that appears modally in Interface Builder. I have a UIBarButtonItem that is on the left hand side, which I would like to appear on the right hand side of the toolbar. How can I do this in IB, or via code?
...
The UIAlertViewDelegate protocol defines two methods, alertView:clickedButtonAtIndex: and alertView:didDismissWithButtonIndex:, which seem to me to be identical in usefulness.
Why is there a clickedButtonAtIndex and a didDismissButtonWithIndex when they both do the same thing? I realize there is also a willDismissButtonWithIndex that ...