three20 TTTabBar performance? - iphone

I used TTTabBar in the Three20 library. It seems to be a good simulator. But its scroll speed is significantly slower in the device (iPhone 4).
All I did was just replacing few names in it. So I was curious if maybe I did something wrong. So I tried the sample project provided by the library. And it's slow too!
How to use it not slowly?
I think the TTTabBar is used in the 'USA TODAY' app. It almost looks the same, but it's not slow. There must be a way.

It can also depend on the content which you are going to load (meaning web content), images from the web service in to the scrollview.
Or maybe you have provided the animation to the component within the scrollview. Check it out.
If it is animation then give minimum animation time as the device can not respond fast to touch or gesture as in the simulator.
Is three20 Library free of cost? I have one for a PDF book to turn the pages like with gesture (how can we know that particular library is free of cost?).

Try to load all your content in the initWithNibName method. (e.g. Parse websites, load images)
That was the solution for me because the content is loaded when the app starts up.

Related

From iPhone app to Universal app, user interface considerations

As I say in the title, I'm developing an iPhone app. I use nib files, I don't use any storyboard, and I know that for iPad I'll need to replace some of the controls I currently use for iPhone, since, for instance, in iPad is more suitable to use popovers in some places, and some other considerations. But I'm not sure if I'd need to create a separate nib file targeted for iPad per each nib file I have now for iPhone, or it should be just the convenient thing but not needed, or I can keep just one nib file if views are for example scroll views or table views, and just resizing things would be enough...
What I want is some guidelines to avoid redundant files and work when creating an iPad version of an existing iPhone version, and what the best practices are, since I donĀ“t find how to handle this, programmatically speaking, neither in Apple's docs nor in posts...
Thanks in advance
EDIT. A question about dealing with icons and images: let's say I have an image view that is 50x50 in iPhone. I have two .png images for the iPhone version of this image: 50x50 and 100x100 for retina display. Let's say I need this image to be 80x80 in iPad. What should be the best way to deal with this: having 4 versions of the image (50x50, 100x100, 80x80, 160x160)? or just having the greatest versions (the 80x80 and 160x160 for iPad), and just resizing them to be smaller for iPhone? In general, what is the best practice about this, having one image file per each size you need, or just having the greater you need and fitting it to smaller sizes?
At xib files you should use the AutoLayout with constraints. That was introduced in ios6.
The key and the war with patience and time it will be setting up correctly those constraints.
One xib can be used to iPhone and iPad too, not needed 2 separate files in this way. As speed of development the 2 file are faster to develop, at least for me...
You can usually get away with not re-implementing a lot of .nib files to be iPad specific and just reuse your pre-existing ones. I have a lot of projects that do this.
That said... you usually have to reimplement the top level container .nib to be iPad specific and you really need to think about where you can take advantage of the larger screen size on iPad and adapt or create new .nibs as you see fit. While you're in any .nib... consider updating it to use AutoLayout if you can!!!
Using child view controllers (UIViewController has had childViewController since iOS 5.0) and other libs like for example SGBDrillDownController (you can find it in CocoaPods.org) might be things to take a look at.
On your images question... If the images scale well and don't get too anti-aliased looking when you go from largest to smallest rendition then going that route can make your life a lot easier. I have found however that to get a decent looking image it is best to use scalable vector art and then create a separate rendition for each size needed. Getting the best possible graphics possible is certainly a key to success.

How Can I Record the Screen with Acceptable Performance While Keeping the UI Responsive?

I'm looking for help with a performance issue in an Objective-C based iOS app.
I have an iOS application that captures the screen's contents using CALayer's renderInContext method. It attempts to capture enough screen frames to create a video using AVFoundation. The screen recording is then combined with other elements for research purposes on usability. While the screen is being captured, the app may also be displaying the contents of a UIWebView, going out over the network to fetch data, etc... The content of the Web view is not under my control - it is arbitrary content from the Web.
This setup is working but as you might imagine, it's not buttery smooth. Since the layer must be rendered on the main thread, there's more UI contention than I'd like. What I'd like to do is to have a setup where the responsiveness of the UI is prioritized over the screen capture. For instance, if the user is scrolling the Web view, I'd rather drop frames on the recording than have a terrible scrolling experience.
I've experimented with several techniques, from dispatch_source coalescing to submitting the frame capture requests as blocks to the main queue to CADisplayLink. So far they all seem to perform about the same. The frame capture is currently being triggered in the drawRect of the screen's main view.
What I'm asking here is: given the above, what techniques would you suggest I try to achieve my goals? I realize the answer may be that there is no great answer... but I'd like to try anything, however wacky it might sound.
NOTE: Whatever techniques need to be App Store friendly. Can't use something like the CoreSurface hack that Display Recorder used/uses.
Thanks for your help!
"Since the layer must be rendered on the main thread" this is not true, as long as you don't touch UIKit.
Please see https://stackoverflow.com/a/12844171/136305
Maybe you can record at half resolution to speed up things, if that fits the requirements?

Huge image I want to manipulate in my Xcode app

I have a huge map image (25mb) that I want to use in my app. The entire point of the app is to pinch zoom and scroll around this richly detailed map.
I am loading it in a uiimageview, with some subview layers that can be toggled on and off to overlay the map.
Everything is working fine code wise and on my simulator, but my concern is that the actual iPhone/iPad may have problems rendering/manipulating a 25mb png image.
Anyone have experience with huge image files in Xcode? Any recommendations or concerns about what I have described?
Someone suggested using uiwebview to display the image. I'm not sure why thy would be any better.
Thanks
Best way to handle very large images is to chop them into easily manageable square chunks and load them dynamically. Here you can see a very nice tutorial for a tiled UIScrollView. Modding the code a bit will surely suit your needs.
Check out the ADC Videos, specifically WWDC 2010 Session 104 "Designing Apps With Scroll Views". This shows how to use CATiledLayer.

Xcode: Pdf's in a UIScrollView with Paging enabled

Im having trouble loading pdf's in a UIWebView when inside a Scrollview with paging enabled and just can't get my head around it.
So i started with the paging sample code available at apple developer, once done that i loaded instead of a Label in the ViewController a UIWebView that loads the Pdf. and it did worked but with a lot of bugs with rotation and scaling on the device.
On iOS 5 scaling is simply not working it zooms but scrolls to top and doesn't allow me to move inside the UIWebView so when I move the only thing i do is move between the pages not inside the UIWebView.
And with iOS 4 it does let me move but has tons of trouble when rotating the device, it doesn't refresh the UIWebView inside to the new frame (even though i do change the frame on didRotate method), so i was wondering if there is another method to load the PDFs that is not a UIWebView that is compatible with zooming and rotating with the UIScrollView with Paging.
Or is there something I should consider when loading the UIWebView inside the UIScrollView? a feature i have to enable or something i am missing?
Because at the beginning I thought it was a bug on iOS 5 and that i was doing something wrong when rotating (which probably i am anyway) but i have several apps on my iPad with ios 5 that do the same but have absolutely no trouble.
I hope you can point me in the right direction.
Thanks in advance!
You should really be using CATiledLayer and CGPDFDocument for this kind of stuff.
There is an example that I found just now : Olive Toast's Blog
Its time consuming to wrap your head around these concepts, but its well worth it. I created a webView+scrollview combo for a pdf reader, which had to be junked and rewritten with CATiledLayer.
Doing it using webview in scrollview gobbles up a lot of resources, ending in a very bad UX
Edit: Apparently there is another post that has a better answer than mine (you may find this link useful)

Is there a View Controller to show thumbnails like the Photos app?

I am looking to replicate the image gallery view that shows thumbnails, like in the photos app on the iPhone.
Is there a view controller or any examples that anyone can provide to replicate this?
There isn't one provided by Apple. I would recommend looking at Three20. It has a few things with look a lot like the Photos app.
Another option is AQGridView.
Take a look at the video of Session 104 from the WWDC 2010. It's basically a 40 minute tutorial on how to do the photo app.
Bear in mind that allowing users to zoom will greatly increase the space required. If you use CATiledLayers, that is, which, depending on your desired zoom level, you should consider doing.
Oh, and there is source code ;)
What they don't tell you is how they did their tiling. I found that you can
a) download ready-made tiles from the server with the app or with a content update (you can use ImageMagick's crop tileWidthXtileHeight - e.g. crop 100x100 - to do the tiling). This has the disadvantage of large downloads.
b) download ready-made tiles from the server as needed (may lead to lags in your app, but then MKMapView does it quite nicely, doesn't it?)
c) tile on the phone as needed (here you can also consider caching the results, although that will likely mean you have to check space left on the device)
I've recently given enormego's PhotoViewer a try. It's easy to use, and it's much more focused than the Three20 project. (Which I also use and like a lot.)