Adobe Edge animation on IOS7 not working - ios

I'm trying to implement an Adobe Edge animation inside a UIWebView in my IOS7 app. But all I get is a white screen. The same white screen shows up on my iPhone's Safari. The animation runs fine on my laptop's browsers, both Safari and Chrome.
I'm thinking this is an Adobe Edge problem, but here's my IOS code anyway:
NSString *filePathString = [[NSBundle mainBundle] pathForResource:#"YallaBye_Button2" ofType:#"html"];
NSMutableString *html = [[NSMutableString alloc] initWithContentsOfFile:filePathString encoding:NSUTF8StringEncoding error:nil];
NSURL *aURL = [NSURL fileURLWithPath:filePathString];
UIWebView *view = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
view.delegate = self;
[view stringByEvaluatingJavaScriptFromString:#"window.requestAnimationFrame = window.setTimeout;"];
[view loadHTMLString:html baseURL:aURL];
[self.indicatorForPlans addSubview:view];
The indicator works fine without the Adobe Edge html.
I also tried running the [view stringByEvaluatingJavaScriptFromString:#"window.requestAnimationFrame = window.setTimeout;"]; call inside the UIWebViewDelegate method - (void)webViewDidFinishLoad:(UIWebView *)webView but no luck.
Also, researching the forums, I tried changing my transform:translateX(0px); to -webkit-perspective: 1000; -webkit-backface-visibility: hidden; but still just a white screen.
What am I missing?

Related

Unable to move UIWebView to a specified section in iOS11 (iPad)

We have used the below lines of code to move to the web view:
[webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:#"window.location.hash=\'#-1\';"]];
[webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:#"window.location.hash=\'#%#\';", index]];
but somehow this code doesn't work only in iPad. Here is how I initialised the web view:
webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
[webView setDelegate:self];
[webView.scrollView setDelegate:self];
[webView setBackgroundColor:WHITECOLOR];
[webView setScalesPageToFit:YES];
[webView setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.view addSubview: webView];
Could someone please guide me how to debug it.
In iOS11 location.hash seems to be broken, but it's a simple solution to this.
Instead using an usual combination:
location.hash = "";
location.hash = _some_hash_string_
use javascript below:
var hashElement=document.getElementsByName(_some_hash_string_)[0];
if(hashElement) {
hashElement.scrollIntoView();
} else {
// if the element is not found - scroll to top
document.documentElement.scrollIntoView();
}

UIWebView or safari or ibooks are not showing e-signatures in pdf

UIWebView displays pdf on UIWebView splendidly.
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
CGFloat screenHeight = screenRect.size.height;
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, screenWidth, screenHeight)];
webView.delegate = self;
NSURL *targetURL = [[NSBundle mainBundle] URLForResource:#"document" withExtension:#"pdf"];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[webView loadRequest:request];
[self.view addSubview:webView];
However, things starts to get a little irritating when it can't display a pdf with e-signature (I got it from http://www.tecxoft.com/samples/sample01.pdf):
However, in print preview it's able to show the e-signature at the top right corner (this only works on iOS 10 and not iOS9):
Question:
Any alternative to display pdf with signature?
I've tried both UIWebView and UIDocumentationInteractionController and it still doesn't display the signature.
Just need to flatten the pdf before displaying it on the webview.

Embedding YTPlayerView In UIScrollView

I'm creating a UIScrollView that can hold images and videos from different sources. I first created and added a UIView for each image/video to the UIScrollView, then add the image/video view/layer. This works fine for images and videos using AVFoundation; however, does not work for videos using the Youtube API.
Here's my code for adding the YTPlayerView to the UIView within the UIScrollView:
YTPlayerView * youtubePlayerView = [[YTPlayerView alloc] initWithFrame: CGRectMake(0, 0, self.scrollViewWidth, self.scrollViewHeight)];
youtubePlayerView.bounds = CGRectMake(0, 0, self.scrollViewWidth, self.scrollViewHeight);
NSString * youtubePath = [media getMediaPath]; //Valid Youtube URL as NSString
NSMutableString *videoUrlCopy = [NSMutableString stringWithString:youtubePath];
NSString *vID = [videoUrlCopy lastPathComponent];
NSDictionary *playerVars = #{
#"playsinline" : #1
};
youtubePlayerView.delegate = self;
[contentView addSubview:youtubePlayerView]; //ContentView is subview of UIScrollview
[youtubePlayerView loadWithVideoId:vID playerVars:playerVars];
[youtubePlayerView playVideo];
When I try to load the youtube video with loadWithVideoId, the process terminates within YTPlayerView here: UIWebView *webView = [[UIWebView alloc] initWithFrame:self.bounds]; throwing EXC_BAD_ACCESS.
- (UIWebView *)createNewWebView {
UIWebView *webView = [[UIWebView alloc] initWithFrame:self.bounds];
webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
webView.scrollView.scrollEnabled = NO;
webView.scrollView.bounces = NO;
return webView;
}
Interestingly, I've gotten the Youtube videos to show adding the YTPlayerView directly as a subview to self.view. Any suggestions?
I figure it out, using
pod 'youtube-ios-player-helper', :git=>'https://github.com/youtube/youtube-ios-player-helper', :commit=>'head'
instead of using pod 'youtube-ios-player-helper'
Cheers

How can I make this GIF appear correctly?

I created a GIF and it is basically snow particles falling and has a transparent background. Therefore I can have just snow flowing over my other PNGs and images on the app. The problem is that the app loads and the GIF appears all white. Not sure why because I gave it transparency when making it. If I lower the alpha in Xcode I still don't see my old PNGs (usual background image).
This is in my ViewController.m
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *filePath = [[NSBundle mainBundle] pathForResource:#"snow" ofType:#"gif"];
NSData *gif = [NSData dataWithContentsOfFile:filePath];
UIWebView *webViewBG = [[UIWebView alloc] initWithFrame:self.view.frame];
[webViewBG loadData:gif MIMEType:#"image/gif" textEncodingName:nil baseURL:nil];
webViewBG.userInteractionEnabled = NO;
[self.view addSubview:webViewBG];
UIView *filter = [[UIView alloc] initWithFrame:self.view.frame];
//filter.backgroundColor = [UIColor redColor];
filter.alpha = 0.5;
[self.view addSubview:filter];
You can set your view background Clear color And for animated image you can use UIImageView.
hope this will be work proper.
See Link:: - Click here to get code
Link2::- Click here for code

multiple UIWebView-s on a UIScrollView

I'm experimenting with a magazine kind of iPad app that I develop and I ran into a memory issue.
There are multiple UIWebView-s on a UIScrollView. Every UIWebView displays an html page each from html file source. Unfortunately I couldn't find the solution to handle the web views to load them smoothly in the background once the app loaded, instead of that it loads and fires every html pages with all its javascripts and images, because I want them to be visible once I swipe through on them, hovewer I get "Received memory warning" message at 30 panels and the app breaks.
The code I use to display the web views is this:
NSInteger numberOfViews = 47;
for (int i = 0; i < numberOfViews; i++) {
CGFloat yOrigin = i * 768;
DetailViewController *detailViewController2 = [[DetailViewController alloc] initWithNibName:#"Detail" bundle:nil];
[detailViewController2.view setFrame:CGRectMake(yOrigin, 0, 768, 1024)];
detailViewController2.view.clipsToBounds = YES;
[scroll.view insertSubview:detailViewController2.view atIndex:0];
}
scroll.scrollView.contentSize = CGSizeMake(768 * numberOfViews,1004);
scroll.pageControl.numberOfPages = numberOfViews;
self.view.clipsToBounds = YES;
self.view.clearsContextBeforeDrawing = YES;
CGRect frame;
frame.origin.x = scroll.scrollView.frame.size.width * scroll.pageControl.currentPage;
frame.origin.y = 0;
frame.size = scroll.scrollView.frame.size;
[scroll.scrollView scrollRectToVisible:frame animated:NO];
self.scrollViewController = scroll;
[self.view insertSubview:scroll.view atIndex:0];
- (void)dealloc {
[scrollViewController release];
[tableOfContentsViewController release];
[portrait release];
[tableOfContents1 release];
[start release];
[super dealloc];
}
The code that displays the html content is inside the DetaildViewController:
NSString *htmlPath = [[NSBundle mainBundle] pathForResource:htmlfilename
ofType:#"html"
inDirectory:#"/htdocs" ];
NSString *html = [NSString stringWithContentsOfFile:htmlPath
encoding:NSUTF8StringEncoding
error:nil];
web.delegate = self;
[web setMultipleTouchEnabled:YES];
[web loadHTMLString:html
baseURL:[NSURL fileURLWithPath:
[NSString stringWithFormat:#"%#/htdocs/",
[[NSBundle mainBundle] bundlePath]]]];
- (void)dealloc {
//---release the memory used by the property---
[page release];
[web setDelegate:nil];
[web stopLoading];
[web release];
[orientation release];
[page release];
[super dealloc];
}
The question is how I can load them smoothly in the backround on the UIScrollView and only fire the javascripts once the panel bounces into the viewport, I plan to display more than 60 webviews with its html pages?
You need to recycle your views. Creating a bunch of views when only one at a time will ever be visible is not a good strategy. Apple has a few lengthy video tutorials on the subject. The basic idea is to use at most 3 or 4 views (UiWebViews). As you swipe and the view bounds become visible you initialize it. When it's no longer visible you destroy it. The Wall Street Journal iPad & iPhone app uses a similar pattern.
Here's link to a few resources & tutorial:
Are there any good UIScrollView Tutorials on the net?

Resources