Subviews on UIImagePicker? - iphone

I was wondering: in Apple's "Photos" app, when the user wishes to share more than one photo, he or she can tap on the individual thumbnails, and a check in a red circle will appear on top of each one, indicating that they've been selected for sharing. Is there any way to mimic this behavior in our apps? By somehow inserting subviews on thumbnails, perhaps...? Thanks in advance.

You can't affect the thumbnail views on a UIImagePicker, so you'll have to implement this yourself. It should be pretty straightforward:
UIScrollView will be the container
a UIView descendant for each tile, containing
UIImageView subview to display the thumbnail
UIButton for the clickable checkmark
Make sure you create thumbnails of your images and cache them, and don't shy away from UIImageView - it is heavily optimized.
There is a great sample app in the WWDC sample code re: UIScrollView that should give you a good starting point.

Related

UIScrollView lags when adding UIView with multiple views

I've been working on a Crosswords app for a while and this problem keep returning no mater what i try.
The actual game runs in an UIScrollView because the player should be able to zoom, pan etc.
To the UIScrollview i have added a UIView. First i tried to add multiple UIImageViews and UILabels to the UIView but it resulted in very bad scrolling performance.
Now I've tried to create 3 subclassed UIViews where i wrote a custom drawRect method for each of them. I need 3 UIVIews because only two of the them needs to be redrawn, but not at the same time. The third one contains the clue numbers which are constant.
My UIScrollView hierarchy look like this:
UIScrollView
UIView
UIImageView (show the game board image)
UIView (shows the marked row/column)
UIView (shows the text the user writes)
UIView (shows the clue numbers)
I think the problem is that i have the UIImageView + 3 UIViews in one UIView. When I try to make this hierarchy it doesn't lag, but I'm not able to zoom, pan, scroll etc.:
UIScrollView
UIImageView (show the game board image)
UIView (shows the marked row/column)
UIView (shows the text the user writes)
UIView (shows the clue numbers)
Can you please try do guide me in the right direction. I will appreciate if I do not have to change too much, because the code in the three UIVIews are pretty long.
Thanks in advance :)
EDIT
Screenshot: http://crosswords-plus.com/puzzles/screen.png
First off, I'd recommend shrinking your UIScrollView and pulling the UIView containing the clues out of it. It sounds like it doesn't need to pan/zoom, so you're just adding to the overhead by having it contained inside the UIScrollView.
Secondly, it's hard to give much of an answer without seeing your implementation, but it seems to me that it's possible to turn the UIImageView/UIView/UIView hierarchy into 1 subclass that draws empty, blacked out or filled-in squares plus row/column numbering as necessary. That way, you only have 1 UIView in the UIScrollView and all of this is probably much simpler.
Is that helpful? Is there a reason you're using a UIImageView for the background? Is there a reason you're separating the row/column numbering from the text the user has entered?

UIScrollView lags on iPhone

I'm trying to create a crossword app. The game runs in a UIScrollView, because the player should be able to zoom, scroll etc. The largest crossword are 21x21 which means there need to be 441 touchable tiles. What i've tried so far were to create an UIView and added it as a subView to the UIScrollView. Then I call a method that creates 441 custom UIButtons and set the backgroundImage.
Some of the UIButtons need to have a custom label overlay, so i added a UILabel and set it on top of the UIButton.
When I run the app in simulator all works as it should, but when i test it on an iPhone 4 the UIScrollView lags a lot.
I don't know if this the way to do it? Can you maybe try to guide me in the right direction of how to do this so the UIScrollView won't lag on a device.
Thanks in advance.
Big UIScrollViews are difficult to make smooth without some sort of caching mechanism, such as the one provided by UITableView.
One thing you can do, however, to make life easier for your rendering, is to make sure to use opaque backgrounds whenever possible. In stead of making a view transparent you should make it the same color as its underlying view. This is something that does help.
Also, I have experienced better performance using imageWithContentsOfFile: in stead of imageNamed: for initializing images to be used in a UIScrollView.
In order to not keep all those buttons in memory, you should work with reusable table view cells, this will really improve the scroll performance. Here's one component that could make your life easier: DTGridView, there are also others (you can check Cocoa Controls)

Is clickable is possible inside scrollview?

In my application i want to load more then one view inside scrollview and also give more no.of imageview inside each and every view...if give so,is it clickable is possible...
give me a solution to do this...
Thank You,
Varshu
Try PhotoScroller sample application. This application demonstrates the use of embedded UIScrollViews and CATiledLayer to create a rich user experience for displaying and paginating photos that can be individually panned and zoomed. CATiledLayer is used to increase the performance of paging, panning, and zooming with high-resolution images or large sets of photos.

iPhone parallax scrolling with UITableView

I am creating a navigation based application, and throughout my application, I want to maintain an image as background. Also, I want parallax scrolling for the background, i.e., when I scroll table view cells vertically, background image should scroll at a relatively slower speed. Also, my application has some images and text in detail views, which should scroll at higher speed and background at a lower speed. This I want is to create a 3D effect. I have gone through cocos2D framework, but its all apps shows a single view and two images, one for foreground and one for background. So I need some starting point, whether I am in right direction or not. Also, is it possible without using cocos2D? Please help me for this.
Thanks in advance.
Try to use the - (void)scrollViewDidScroll:(UIScrollView *)scrollView of UIScrollViewDelegate.
The table view is a sub-class of UIScrollView.

Iphone Custom Scrollview indicator

I am currently working on an application for a client, and they have made an odd request. The request involves putting a custom image as the indicator for the scrollview. I am not even sure if this is possible but if it is can you please let me know how one would go about doing that.
Thanks
UIScrollView streches a small, semi-transparent circle image to generate its scrollbars. You can find this image as the first subview of a UIScrollView:
UIImageView *circle = [scrollView.subviews objectAtIndex:0];
However, as I said this image is stretched, and as far as I can tell, only the alpha values are considered when drawing the scroll bars.
So for example if you're only interested in changing the top/bottom ends of the scroll bar, you can try to change this image. However, I doubt you'll be able to do anything interesting.
A possible solution that comes to mind, and this is only a theory, is to add a custom, transparent UIView on top of a UIScrollView. Then you can hide the default scroll bar (by using showsHorizontalScrollIndicator and showsVerticalScrollIndicator), pass the necessary touch events to the UIScrollView to scroll the content, and draw the scrollbars in your custom view.