Animation not working on iPad. same works on iphone - iphone

I've got a very simple project that tries to animate a UIView using block based iOS4.0 animation.
header
#interface animatepadViewController : UIViewController {
UIView *contentView;
}
#property(nonatomic, retain) IBOutlet UIView *contentView;
#end
implementation
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
[UIView animateWithDuration:1.0 animations:^{self.contentView.alpha = 0.0;}];
}
I've added a subview of type UIVIew in the interface builder with a background color of black.
these are the only change i've made from the default ipad "view" based project.
I get the following error
2010-12-28 17:59:05.689 animatepad[29835:207] *** +[UIView animateWithDuration:animations:]: unrecognized selector sent to class 0x217689c
this happens only on the ipad and NOT on the iPhone
thanks in advance

Have you updated your iPad to use iOS 4.2 yet? Blocks weren't available on the iPad's shipping version of iOS (3.2.)

To update the simulator, you will need to update Xcode to version 3.2.5.

Related

iOS enabling AirPrint for uiwebview contents

I am super new to XCode and App development. I currently am loading up a web based application in uiwebviews on the iPad. When one particular page is loaded, it displays a pdf file. I would like to be able to print this pdf file using AirPrint. I am looking for a simple solution. Currently the app I am working on has 6 files which it uses.
-ViewController.m
-ViewController.h
-MainStoryboard_iPad.storyboard
-MainStoryboard_iPhone.storyboard
-AppDelegate.h
-AppDelegate.m
In the MainStoryboard files, there are many windows (graphical) which are liked to a central navigation system. If it is possible to spend some time to really explain what I need to do, and not 'take a look at this link.' I have programming experience, but never with XCode or any product related to Apple.
I figured out how to do this. Firstly I found a piece of code here, iOS Air print for UIwebview, I had no idea how to implement this at the time, but then I did as follows.
My application was a single view XCode project
In my storyboard I inserted a button (on my navigation bar) and changed its Identifier to 'Action' then, making sure to have the 'tuxedo' editor view open, displaying my ViewController.m file, I clicked and dragged from the button to the ViewController.m file while holding down control. This inserted my IBAction method after asking for my buttons id.
myActionButton
Then I copied in the code specified in response 3 of the question. My ViewController.m looked something link this.
#import "ViewController.h"
#interface ViewController()
#end
#implementation ViewController()
//Some stuff here
#end
#synthesize webView
-(IBAction)myActionButton:(id)sender{
UIPrintInfo *pi = [UIPrintInfo printInfo];
pi.outputType = UIPrintInfoOutputGeneral;
pi.jobName = webView.request.URL.absoluteString;
pi.orientation = UIPrintInfoOrientationPortrait;
pi.duplex = UIPrintInfoDuplexLongEdge;
UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
pic.printInfo = pi;
pic.showsPageRange = YES;
pic.printFormatter = webView.viewPrintFormatter;
[pic presentAnimated:YES completionHandler:^(UIPrintInteractionController *pic2, BOOL completed, NSError *error) {
// indicate done or error
}];
}
Also in my ViewController.h file
#import ...
#interface ViewController : ...
{
IBOutlet UIWebView *webView
}
#property (nonatomic,retain) IBOutlet UIWebView *webView
#end
I didn't setup the webviews so I am not 100% sure on how they are created, but there is a good series for beginners on youtube at HackLife87 which shows how to make a single view app. I think XCode Tutorial Video #7 involves setting up views.
Since I am extremely green to XCode and IPad app development, I managed to solve my problem by combining knowledge from watching the aforementioned XCode tutorial videos and then implementing the solution provided on stackoverflow by Hafthor.

Method calling sequence is changed in IOS 6.0 and IOS 5.0

I am running one Application for ios 6.0 and ios 5.0 but few methods are calling in different sequence for both of the version. I am not getting what is the issue. This is console log for iOS 6.0
Two-stage rotation animation is deprecated. This application should use the smoother single-stage animation.
2012-12-15 18:20:23.111 Testl3675:22803] ADDRESPONSE - ADDING TO MEMORY ONLY: http://gsp1.apple.com/pep/gcc
2012-12-15 18:20:23.670 Test[3675:1d903] View did load
2012-12-15 18:20:23.724 Test[3675:1d903] Download Notification----------
2012-12-15 18:20:23.773 Test[3675:1d903] Loaded explore view
2012-12-15 18:20:23.793 Test[3675:1d903] IntegrationManager initialized
And here is ios 5.0 console log
2012-12-15 18:29:44.828 Test[3760:15e03] IntegrationManager initialized
Anyone knows why this is happening?
I got that message, and that was because in
-(void) viewDidLoad {
[super viewDidLoad];
// my implementation
}
is WRONG.
To fix this, I did this:
-(void) viewDidLoad {
// my implementation
[super viewDidLoad];
}

Add Zooming to UIScrollView

I've been doing the tutorials in the Big Nerd Ranch Iphone development book and ran into an issue I can't solve or find an answer for.
The App (Hypnosister) basically just draws a bunch of concentric circles and places some text on the screen using the DrawRect method. I got that to work and I was able to add scrolling ot the view but can't add the ability zoom. I've checked my code 100 times and can't figure it out. I think they used an earlier version of the OS and I am using 4.2. Did something change? Can you find the issue?
Here is the relevant code:
#interface HypnosisterAppDelegate : NSObject <UIApplicationDelegate,
UIScrollViewDelegate>
{
UIWindow *window;
HypnosisView *view;
}
and this goes in the application didFinishLaunchingWithOptions part:
[[UIApplication sharedApplication]
setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
and method gets called after that method closes:
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
return view;
}
HypnosisView is a UIView class that does the drawing. Thanks for the help.
Just downloaded the examples for the book from the Big Nerd Ranch website and it works fine on the simulator under 1OS 4.3. Did you add these lines of code to didFinishLaunchingWithOptions:
// Enable zooming
[scrollView setMinimumZoomScale:0.5];
[scrollView setMaximumZoomScale:5];
[scrollView setDelegate:self];
This is only possible problem I can think of based on the code you've shown.

Hiding iAds programmatically in iPhone

Currently I am showing iAds in my app.They are working fine.Now, I want to hide the iAds based on some conditions in code.
What I am using is
ADBannerView *bannr= (ADBannerView *)[self.view viewWithTag:1];
bannr.hidden = YES;
bannr.userInteractionEnabled = NO;
iAds get hidden.But when i press the area where iAd is supposed to be.Advertisement details window popup
With my iAds I transition them on or off screen after the relevant callbacks are received by it's delegate.
It works for me fine.
Hope this helps
Good Luck,
Since ADBannerView is a subclass of UIView you should be able to remove it using removeFromSuperview.
[bannr removeFromSuperview];
It doesn't explain why you still can interact with the hidden view but you should be able to keep going.
Update
Alternative solution: If the ad gets triggered even when hidden you can perhaps try this in the delegate:
- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave {
if (banner.isHidden) {
return NO;
}
// Business as usual
}

Combining OpenGL ES template and Utility template

I would like to have an OpenGL view with an utility application.
What I do:
I create an OpenGL ES application template and a Utility Application template.
I copy the files EAGLView.m and h, and the five ESrenderer. files from the Opengl project to the utility project.
I copy these lines from the OpenGl project to the Utility project: (in utilityAppDelegate.m)
- (void)applicationDidFinishLaunching:(UIApplication *)application {
...
[glView startAnimation];
}
- (void) applicationWillResignActive:(UIApplication *)application
{
[glView stopAnimation];
}
- (void) applicationDidBecomeActive:(UIApplication *)application
{
[glView startAnimation];
}
- (void)applicationWillTerminate:(UIApplication *)application
{
[glView stopAnimation];
}
- (void)dealloc {
...
[glView release];
...
}
And in the utilityAppDelegate.h I add:
#class EAGLView;
EAGLView *glView;
#property (nonatomic, retain) IBOutlet EAGLView *glView;
I go to the view's identity inspector, and change the class identity to EAGLview.
I open the mainview.xib and mainwindow.xib and drag the app_delegate from the mainwindow.xib, to be able to connect the glView outlet to the view.
(Don't know if this is the way to do it, but that's the only way I could connect the glView variable to the view)
When I build and run, the multi colored square show up on the screen, but it does not animate!
When I debug, the glView variable is 0 in applicationDidFinishLaunching, and the startAnimation is not called. I suspect this has something to to with the way the outlet is connected to the view? Probably not connected. :-)
The mistake is probably obvious, but I have only been 5 weeks on this platform.
What is missing? What have I done wrong?
Thank you!
I don't know if you've provided enough information to tell exactly what's going wrong in your case. However, I'd suggest that you look at the source code for my iPhone application Molecules.
While it is a little more complex, the application is based on those two templates. It uses an OpenGL ES main view (where a 3-D molecular rendering is presented), and a table view / navigation controller on the flipside (for switching molecular structures, examining their properties, and downloading new ones). You could review that example to see what you might be doing wrong, or even just replace my rendering and view code with your own.
I got the solution in another forum:
http://iphonedevbook.com/forum/viewtopic.php?f=25&t=3192&sid=9cf79468b81a8fd6c9d9020958d33388
Basically, just add the glView outlet to the MainViewController instead of the AppDelegate.