iphone – How do I add videos to iPad simulator?

Took a sec (and some deviousness) but I figured it out. Put a video file into your application’s Documents directory, I tried a .MOV but that didn’t work, a .m4v worked. Then put this early in your app (I just stuck it in application:didFinishLaunchingWithOptions): NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@”Documents/myMovie.m4v”]]; UISaveVideoAtPathToSavedPhotosAlbum(path, self, @selector(video:didFinishSavingWithError:contextInfo:), nil); And … Read more

Where are the UIKit Framework implementation files located?

The source code (as hotpaw2 said) is only available to Apple, but there are multiple ways you can see what’s going on: Using the program class-dump (example output for UIKit: https://github.com/kennytm/iphone-private-frameworks/tree/master/UIKit/ ), you can view all the private methods and instance variables of the UIKit classes, to see how they implement them at a higher … Read more

How to download PDF and store it locally on iPhone?

I have found one method which I tried myself: // Get the PDF Data from the url in a NSData Object NSData *pdfData = [[NSData alloc] initWithContentsOfURL:[ NSURL URLWithString:@”http://www.example.com/info.pdf”]]; // Store the Data locally as PDF File NSString *resourceDocPath = [[NSString alloc] initWithString:[ [[[NSBundle mainBundle] resourcePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@”Documents” ]]; NSString *filePath = [resourceDocPath stringByAppendingPathComponent:@”myPDF.pdf”]; [pdfData … Read more

how to get the event that switch tab menu on iphone

Implement UITabBarControllerDelegate e.g. in your app delegate’s applicationDidFinishLaunching – (void)applicationDidFinishLaunching:(UIApplication *)application { tabBarController.delegate = self; [window addSubview:tabBarController.view]; } Then implement either: – (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController; – (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController; The first method is called before the view switch and gives you a chance to ‘veto’ the view switch by returning NO The second … Read more

Deactivate UIScrollView decelerating

This can be done by utilizing the UIScrollView delegate method scrollViewWillBeginDecelerating to automatically set the content offset to the current screen position. To implement: Assign a delegate to your UIScrollView object if you have not already done so. In your delegate’s .m implementation file, add the following lines of code: -(void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView{ [scrollView setContentOffset:scrollView.contentOffset animated:YES]; … Read more