How to load images in ImageView with delay? - android-imageview

I am trying to make gallery and display gridview of ImageViews, but with delay in loadtime of each thumbnail.

You can use a Handler with postDelayed method and a Runnable then. You will find many samples.

Related

UIImageView showing content with severe delay

This is really a mystery for me (iOS 8, Xcode 6.x, Storyboard):
I'm presenting one view controller (VC) modally, overlaying on the VC presenting it.
On the VC being presented, there's a static image with pdf assets. When the VC is loaded, the image doesn't show up, then after like 20 seconds, it shows up.
What could have gone wrong? I have image cache setup inside this VC's code, so I removed that, result the same. I also tried to switch the asset to a png image, still the same. I'm really confused now, any comments?
Sounds like your not setting the image on the main thread.
Wrap this around your line of code where you set your image.
dispatch_async(dispatch_get_main_queue(), ^{
// set your image here
});

Gesture recognizer for tap event at specific positions on the screen

I am displaying hundreds of thumbnails in my view . I know default way to handle tap on thumbnail is using UICollectionView delegate method "didSelectItemAtIndexPath" but since its many thumbnails i wanted to look into adding gestures to the screen position so when i tap on a particular spot on the screen, it will handle the event accordingly for that particular thumbnail underneath. I would like to know if it is a good/possible approach?
It would be a hell of a lot easier to use a UICollectionView.
If you need a custom layout then you can subclass UICollectionViewLayout and get some really cool dynamic layouts.
You also get the added bonus of dequeued cells meaning that you get better memory management using it.
You may find UIGestureRecognizer useful. A good tutorial to get you started is here.

PopOut a middle Image in a UIScrollView contain many images

I have problem in playing with the UIScrollView i am using a customImage Object class to display images on scroll view and event fire on each image i achived it all but i have to do a extra work on it as the giving image showing that the middle image is pop out and fire event for that popout image...
i am confuse in it can anyone tell me how to achive this ....
please told me some steps to start with it..
You should be implementing the UIScrollViewDelegate protocol in the controller which should be handling the UIScrollView.
In there you will get a plethora of delegate callbacks such as when the scrollView moves or is decelerating towards a complete stop etc.
"UIScrollViewDelegate iOS reference"
You can implement any of the methods to suit your exact needs and modify the image's properties. To find which image is in the middle you would be comparing the contentOffset property of the scroll view o image locations.

Simple slideshow in a UIImageView

I got trouble to add slideshow to my application.
Currently, I have a UIView composed of a segmentedControl.
I made ​​two "views" that I hide or display depending on the selected button.
I'm looking to make a simple slideshow in one of my two views. I made a UIImageView because it is simple to display pictures.
So I'd like to display my pictures one by one and it is possible to move from one image to another by sliding your finger to the right or left (just as in the native app "Photos").
I tried to adapt example codes from the documentation, but without succes.
So I'ml looking for help.
Thanks,
jb crestot
SO, I've actually done this and it's fairly easy. The ingredient that you are missing is a UISCrollView. My implementation did exactly what you describe (allow the user to go back and forth between a set of images).
Basically, add a UIScrollView to your View in interface builder and you will be creating the UIImage views with code (a simple for loop) and setting their images the same way. I did this safely with no memories issues with about 15 images (PNG's). There could be a potential performance issue with this message if you are working with a large number of images (say 40?)
I hope this helps, let me know if you need a code sample to see how this works.
You may consider using a custom class, such as iCarousel, linked below. Each of these views could be your image, and then tapping on them could launch a fullscreen view for example.
Keep us posted!
http://cocoacontrols.com/platforms/ios/controls/icarousel
See apple's page control sample application.

Cocoa question for displaying images

I was wondering if anyone could tell me if there is a method in Cocoa that will display information (images) on screen when a button is pressed. What I mean is NSLog "prints text" to the console is there a method that displays images just as easily like would -(void)drawView do it? Is it just setNeedsDisplay? I hope this makes sense. I am essentially wanting to know if I can call something that will display an image as easily as you can display/print text to the screen/console.
The Console is text-only, so no, you can't print an image to it the same way you log text. The closest equivalent is to export the image as TIFF data and write that data to a file in the temporary directory.
As for setNeedsDisplay:, that tells AppKit that the view should be told to redraw the next time the window redraws its views. (In other words, it sets the view as needing display—exactly what it says on the box.) Usually, this is because you've changed the model object(s) that the view displays, either by replacing them with other objects or by mutating one or more of their properties.
You would need to have a view to display; an image view would certainly qualify, but if you're looking for the image equivalent to NSLog, this isn't it, unless you don't mind either making a dedicated window just for showing this image or temporarily putting a image view into one of your real windows.
You should take a look at Apple's NSImageView Class Reference.
This a class you can use to display an image in Cocoa.
setNeedsDisplay is a NSView method that tells the graphics renderer it needs to redraw the image because the data has been modified. Presumably because you are using something like Quartz and you have called some custom drawing code. If you are drawing bitmap images then you probably won't need to use this.