cocoa-touch

UIButton as UINavigationbar button

I have a Tab bar application. and in one of the tab bars I have a navigation contorller. Im trying to set a UIButton with an image as the right button the navigation bar. UIButton *refreshButton = [[UIButton alloc] init]; [refreshButton setImage:[UIImage imageNamed:@"refresh_icon.png"] forState:UIControlStateNormal]; [refres...

How can I scale at an anchor point using CGAffineTransform?

Edited to better explain my problem I am trying to perform a zoom operation using my custom view (not UIView). The view has translation, scale, rotate values. I use these as follows, between calls to glPushMatrix() and glPopMatrix(). - (void)transform { glTranslatef(translation.x + anchor.x, translation.y + anchor.y, 0.0f); //g...

About the orientation of iPhone

How to get the current orientation of iPhone? I surfed this site, and found two methods as followings. [UIApplication sharedApplication].statusBarOrientation; [[UIDevice currentDevice] orientation]; Which one is the right way to get the current orientation ? I tried two methods under simulator 4.1, but there are some problems for bot...

Find all controls of a type in a UIView

I am looking for a way to automatically localize texts on buttons/textfields etc and for this method I need to find all (for example) UIButton's on a UIView. I tried the following 2 methods, but they both do no work like I want them to work: for (UIView* subView in self.view.subviews) { NSLog(@"object class : %@", [subView class]);...

Finger drag on your bottoms

Hello all, assume that a five buttons side by side, i need to know how to make them accept (Called) the drag from outside to inside the border of each button i.e. Like the piano if u drag your finger every button called and make sound Thanks ...

UIMenuController with a set of colored button

I have a requirement - in an application i'm currently developing - to show a list of colors upon clicking on a button so the user can select a single color out of the list. I strongly believe the best way to this would be to have a UIMenuController popup - just like you'd see the copy/cut/paste menu in iphone - and show the list of colo...

UISwipeGestureRecognizer gesture start point.

Is it possible to get a gesture start point from a UISwipeGestureRecognizer. like how its possible in - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch * touch = [touches anyObject]; gestureStartPoint = [touch locationInView:self]; } ...

Cross-fade within AVMutableVideoComposition

I have successfully composed an AVMutableComposition with multiple video clips and can view it and export it, and I would like to be able to transition between them using a cross-fade, so I want to use AVMutableVideoComposition. I can't find any examples on how to even arrange and play a couple AVAsset videos in succession. Does anyone...

CALayer and Off-Screen Rendering

I have a Paging UIScrollView with a contentSize large enough to hold a number of small UIScrollViews for zooming, The viewForZoomingInScrollView is a viewController that holds a CALayer for drawing a PDF page onto. This allows me to navigate through a PDF much like the ibooks PDF reader. The code that draws the PDF (Tiled Layers) is lo...

Is there a standard way of playing longer sound clips?

I'm currently using AudioServicesPlaySystemSound(_soundID) to play sound clips. My understanding is that this can only be used to play clips under 30 seconds. What is the standard way of playing longer sound clips? ...

UITableView row animation duration and completion callback

Is there a way to either specify the duration for UITableView row animations, or to get a callback when the animation completes? What I would like to do is flash the scroll indicators after the animation completes. Doing the flash before then doesn't do anything. So far the workaround I have is to delay half a second (that seems to be t...

Playing video and audio in iPhone directly from server

Hi All, I have never played with audios and videos in iPhone. My requirement is : 1.When user selects from the list of podcasts(which I get from the server),I want to play an audio(mp3 file).I have the url for that mp3 file.He should have the controls for playing and pausing the audio(and other normal controls). 2.When user selects fr...

Problem while subclassing UIAlertView and using subclass as the delegate.

Hi I'm having a little problem. I subclass'd UIAlertView and I named it UIDisclaimerAlertView. So far so good, the subclass is working fine. But now I wanted to use this very class as its own delegate. So in my subclass I used : self.delegate = self; I did this because I wanted it all in the same class file. Now the problem I'm facing...

Width of detailTextLabel on cell with UITableViewCellStyleValue2 style

Hi guys! I'm new to stack overflow and to cocoa-touch developing. I'm trying to build a UITableViewCell using the UITableViewCellSytleValue2 with a multi-line detailTextLabel. Therefore I implemented the tableView:heightForRowAtIndexPath: like that: - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)i...

Adding new info in Address Book iPhone

How can I add an address to a Address Book contact in iPhone? ...

Show keyboard with a UIPopover

How can I show the keyboard when my popover shows up? The popover is UIViewController that I call from a popoverController. The popover has an UITextField and when the popover is displayed, the keyboard need to show up too and the cursor go to the UITextfield. I tried to put the becomeFirstResponder under viewDidLoad or viewWillLoad,...

How to sort an array of an array of objects by those objects attributes

If have an NSMutableArray foo of an NSMutableArray bar of objects. Each of the objects have a property that is a numerical value. In each NSMutableArray bar I want to sum this numerical property of each object. Then I want to sort the NSMutableArray foo by this sum. What's a good way to do this? ...

Using sortUsingSelector on an NSMutableArray

I have used sortUsingSelector to sort an NSMutableArray of custom objects. Now I'm trying to sort an NSMutableArray containing NSMutableArrays of custom objects. Can you use sortUsingSelector on an NSMutableArray, or does it only work for custom classes? ...

Swapping elements in an NSMutableArray

Are there any special methods to make swapping elements in an NSMutableArray easier or more direct? ...

How to get a single NSString character from an NSString

I want to get a character from somewhere inside an NSString. I want the result to be an NSString. This is the code I use to get a single character at index it: [[s substringToIndex:i] substringToIndex:1] Is there a better way to do it? ...