Images in UIScrollView, how to detect tap? - uiscrollview

I have many UIImages created at runtime in a UISCrollView; i would like to call a new ViewController when the user taps on an image, but i would like not to change controller when the user swipes on it.
Which is the best thing to do?

Related

How to drag a View Controller on top of a View Controller?

I have a View Controller that is presented when you first open the app, and I have another controller that can be shown on screen if you tap a button at the top of the screen. However, instead of doing it this way I was wondering if I can either drag the view down or tap the button and have an animation take care of that.
I have tried doing this with a PageView Controller, but this doesn't show the effect I wanted as it simply translates over to the next view and doesn't actually keep the initial view fixed in place while the second view slides over it.
Also, instead of a view controller would a view initially placed out of bounds in the main View Controller work? Thanks in advance!
You could use a side menu like MMDrawerController that has 4 type of animations for presenting the viewController.
Or you can create your custom UIView (not viewController) even using Interface Builder and animate that screen yourself. The animation can be started using UIScreenEdgePanGestureRecognizer.

UIPage Control custom style NatGeo

In my app I have UIView that flow through the use of a horizontal scrollView. To scroll the view I used the classimo method [self addChildViewController: [self.storyboard instantiateViewControllerWithIdentifier: # "name Storyboard ID"]];
Each UIView is followed through the use of UIPageControl classic, but I do not like it and so I wanted to create something like this (see photo)
as you can see from the images above application there is a menu with a triangle pointing down, Indicating the page, passing from one topic to another user through the horizontal swipe on the scrollView
In other words, instead of having the classic shot for the management of the pages, the National Geographic has used a triangle pointing down and the title of the page on which the user is ...
Could someone help me understand how can 'be created a similar PageControl?
There are a lot of approaches to implement this. Maybe the custom PageControl won't be the subclass of a UIPageControl.
For example, you can subclass a UIView, and put a UIScrollView in it. And then put a bunch of UIButtons in a row into the UIScrollView, each of them has a title that is your page's title. When you tap a button ( you can get this event by UIButton's -addTarget:action:forControlEvents:), you can scroll the tapped button to the right position, highlight it, and put a little triangle below it.
There are many possibilities. Say, you can replace the buttons with UILabel and add UITapGestureRecognizer to capture the users tap, or you can replace the UIScrollView with UITableView if you get a long list of pages(Of course that will introduce some complexity). You just need to pick your favorite and try it out.

Highlight NSImageView in NSView

I have a simple question. I have my NSView which is detecting drops (drag and drop). When user drops a link with image from browser, I detect that action, create NSImageView, initialize it on a place where user dropped it with some default frameSize and put the image from the link into it.
I would now like to highlight that NSImageView when user clicks on it. I also want to implement moving around that NSImageView in NSView but I'm pretty sure I will manage that. How do I highlight that exact NSImageView which was clicked? I haven't created earlier that NSImageView in interfacebuilder and assigned a special class for it so I can use drawRect, I have just created it dynamically...
Any help would be appreciated.
You can use NSImageView's setImageFrameStyle for highlighting.

ImagePicker slow with large photos

I apologize i don't have any code to show for this problem. But i hope i can explain it well enough.
What should happend.
Users Taps a Button:
Image Picker is displayed. (present modal view)
User Chooses a photo:
the image picker dismisses (animated)
the chosen image is then loaded into a global object ( singleton)
and the chosen image is loaded into a IBOutlet UIImageView. in the current view.
A new view controller is pushed (animated ) which displays the image much larger.
For the most part this happens fine, however if a large photo, such as a photo taken by the iPhone 4 camera is loaded. the application lags and it jumps to the pushed view with no animations for the picker dismisal and the pushed viewcontroller.
is there a way to handle this better so the animations are shown?
performing certain task in the background with a selector?
Many thanks for your help.
Tom.
My only solution was to resize my image before pushing the next view controller!

Cocoa objective-c, is there an equivalent to PHP sessions?

My app lets the user create multiple custom views by clicking a button (the views are simple circles). When they mouseDown on the circle I send a message to the NotificationCenter and run Core Animation to make the view pulse (fade in and out). I also set NSView *activeView to the view passed to the NotificationCenter.
In the background of these user created views is a custom view named gameMap. If a user clicks outside of one of the circles then gameMap sends a message to the NotificationCenter.
What should happen here is the activeView (circle) should move to the mouse click point. But because the NotificationCenter is in my AppController class, if it is being notified of a click outside of a circle view it doesn't have an activeView to reference.
I need a way to store, independent of classes, the activeView. In PHP I would just use a $_SESSION['activeView'] = $thisView, or something similar. Can I do something like this in cocoa?

Resources