Resize StageWebView on iPhone - iphone

I have an iPhone app which uses facebook. The user experience is not great if you just create a stagewebview object because of the lag in anything showing up when the page is being downloaded. The way I tried to get around it is like this:
ShowLoadingAnimation();
webView = new StageWebView();
webView.stage = this.stage;
webView.viewPort = new Rectangle( 0,0,0,0);
webView.addEventListener(Event.COMPLETE,PageLoaded);
public function PageLoaded(e:Event):void
{
webView.viewPort = new Rectangle( 0, 105, 600,295);
RemoveLoadingAnimation();
}
So create an empty stageview which is obscured by a beautiful :-) loading animation and when the page has been loaded - we resize the webview to it's proper size. Works perfect in a desktop AIR player. But on an iPhone it doesn't work at all and you end up with a very large black box.
Anyone has any idea on how to fix this OR a better way of doing this?

By default stageWebView objects are always at the top of the display list stack.
This means that your loading animation is underneath.
The correct way to do this is to show your loading animation and then wait to set the stage property of the stageWebView object until the page is loaded.
Hope this helps.

Related

Change the overlay image live in wikitude?

Is it possible to change the overlay image after a certain time or period with using the WikiTude ImageTarget? Even live without restarting the camera view?
If you have a AR.ImageDrawable (var overlay = new AR.ImageDrawable(img, 1,{}); ) you can change the image resource by calling overlay.imageResource = newImg; Put this code into a function and call it with a timer or anything else.
Hope I've been able to help you.

Responsive website doesn't scroll smoothly on iPhone

I am having troubles with scrolling on my website on an iPhone.
What I mean by that is that normally, when you start scrolling and then release the display, the site will keep scrolling for a bit on an iPhone. But with this site, it doesn't. As soon as you remove your finger from the display, it will stop scrolling. It is as if the scrolling is sticky.
I really have no idea where I should even begin to look to debug the problem, which is why I am not posting the code (I'd have to post the complete website).
The issue is also not showing up on my Nexus 5. I have had the issue on two different iPhone 5.
I am basically looking for points to start to debug the problem right now.
Apply this script on the master page means if you have a Common layout page :
$(document).ready(function(){
var deviceAgent = navigator.userAgent.toLowerCase();
var agentID = deviceAgent.match(/(iPad|iPhone|iPod)/i);
if (agentID) {
$('body').css('-webkit-overflow-scrolling', 'touch');
}
});

Images disappear during translate3d on Chrome for iPhone and iPad

I have a coverflow type image gallery that I have created for mobile picture viewing. The first iteration lives here: http://codepen.io/jasonmerino/pen/Fsloq.
I've wired up the touch events and all seems to be going well for mobile Safari on iPhone and iPad, but when I go to view it on Chrome for iPhone or iPad the images disappear during part of the CSS translate3d which moves the images to the sides.
I have added -webkit-backface-visibility: hidden; to all of the markup that comprises the swiper, which does not fix this disappearing act my images are doing.
What am I missing here? Any help would be appreciated. Thanks!
The problem was with the peice of code where I was removing inlined CSS translate3d. The code that I had in place dealt with removing the translate by just re-assigning the background images.
for (var i = 0; i < images.length; i++) {
$el.images.eq(i).css('style', 'background-image: url(' + images[i].src + ')');
}
In mobile Safari this was fine, but in Chrome the images reloaded when I re-assigned the background image, hence the disappearing act. So I adjusted my code to be a little smarter, and concise, so that I only removed the translate from the inlined styles.
$el.images.css('transform', '');
Turns out that when you pass an empty string as the value to a CSS attribute in jQuery they just remove the style out for you instead of leaving it there but blank. Makes sense, but I never knew that before.
Anyway, that's what fixed it for me.

How to show a PDF page by page using horizontal swipe in iphone?

I want to create a page by page PDF reader.
I know how UIWebView can be used to show the PDF but It will load the entire PDF and want to show one page at a time.
The PDF is stored locally.
Next and previous PDF Pages should be loaded depending on the horizontal swipe.
How to show a single page along with horizontal Swipe and Zooming functionalities ?
What is the best approach for such problem?
Is there any tutorial for this?
EDIT :
I have used CGPDF APIs to show the PDF page by page.
I am using the PDF page as image.
But zooming is not working properly as UIPageControl is also used.
How to zoom these images along with page control ?
You can use Leaves View, you can find tutorial from
https://github.com/brow/leaves
second option is FastPDFKit, you can get it from
http://mobfarm.eu/
According to me leaves is more preferable because memory management is good and it is more user friendly.
EDIT:
You can consider two more options which provide some good features for PDF.
Reader on Github
PSPDFKit
Note: PSPDFKit is not free.
EDIT:
Since iOS 5, you can add an effect of swiping the page like iBooks. To do it that way you can use UIPageViewController. To get some basic idea, just create an app with page-based application from your Xcode template or you can refer to this link.
you add as a subLayer the tiledLayer that draws the PDF page (CGContextDrawPDFPage) to a UIView and then you add that as a subview to a UIScrolView. That way you have a PDF page that you can zoom by pinching it and you can scroll.
Lets say you create a class PDFViewController:
[myContentView.layer addSublayer:tiledLayer];
...
[scrollView addSubview:myContentView];
...
[self.view addSubview:scrollView];
and then you should create MagazineViewController class where you have a large horizontal UIScrollView where you create the views from the PDFViewController that contain the pages, That way you have a view that you can swipe horizontally and see the pages of a magazine or a book.

how to load the pdf through programming with animation in iphone

how load a pdf into iphone and my pdf is of 200 pages then it should allow to turn the pages as we do with while reading book manually means use animation to turn a page one by one ..
Thanking you ..
Loading a large PDF and having page flipping animation isn't very simple. You can use a UIWebView like #Jim says to load the entire thing by just pointing the UIWebView's URL to the PDF but you won't get page animation. However to get full control requires that you render the PDF page by page manually to a view, and create the view's turning animation your self. Its nontrivial, and given your question you don't sound like you know enough to realistically achieve this right off.
Use UIWebView Control to load pdf files.