UIImageView photo transition effect Xcode 5 - uiimageview

I want to add a transition effect between images like fade or anything else.
Here's my code:
-(IBAction)startSlideShow:(id)sender;
{
self.imageView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:#"slide01.png"],
[UIImage imageNamed:#"slide02.png"],
[UIImage imageNamed:#"slide03.png"],
[UIImage imageNamed:#"slide04.png"],
[UIImage imageNamed:#"slide05.png"],
nil];
self.imageView.animationDuration = 15.0;
self.imageView.animationRepeatCount = 0;
[self.imageView startAnimating];
}

Try this, I think you looking for this one,.. github.com/jberlana/JBKenBurns
(or)
I found this on someother search, try this too..
http://www.raywenderlich.com/10518/how-to-use-uiscrollview-to-scroll-and-zoom-content
Other simple way to achieve: Steps to achieve
Add all the images in one scroll view.
Enable paging for that scroll view.
Based on the content offset of the scroll view highlight the appropriate dot(indicator in the bottom).

Related

UIImage Animation Reverting Back To Original Position

Im pretty new to coding but I'm starting to get the hang of the basics.
how to make an image stay in its new position after an animation?
Example:
I'm giving an animating object a random position, however, the animation causes the object not to animate at the random position, but instead animate at the position it was given in the view controller. This also happens when I animate a completly different object.
Code I used:
int Random1x;
int Random1y;
IBOutlet UIButton *Start;
IBOutlet UIImageview *Object2;
-(void)ObjectMoving;
-(void)Object2Animate;
-(IBAction)Start:(id)sender{
[self ObjectMoving];
[self Object2Animate];
}
-(void)Object2Animate {
Object2.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:#"2.png"],
[UIImage imageNamed: #"3.png"],
[UIImage imageNamed: #"4.png"],
[UIImage imageNamed: #"1.png"], nil];
Object2.animationDuration = .5
[Object2 setanimationRepeatCount: 0]
[Object2 startAnimating];
}
-(void)ObjectMoving {
Random1y = arc4random() % 466;
Random1y = Random1y + 60;
Random1x = arc4random() % 288;
Object2.center = CGPointMake(Random1x, Random1y);
}
I'd greatly appreciate help, thank you!
If you go to your story board file and click on the View Controller and then file inspector you will see a box for Auto Layout
Post back if that worked.
If you do need to use auto layout then you would have to figure out a different way of moving the image.

iOS5 combine CGAffineTransform with animationImages?

I'm pretty new to iOS animation and I'm wondering if it's possible to combine an transition between two images along with a translation animation of the UIImageView using CGAffineTransform?
In other words I have two images that I want to animate between, and then I want to apply a simultaneous translation so that the whole thing moves across the page while moving back and forth between the two images.
I know I can apply a CGAffineTransformConcat to combine two CGAffineTransforms such as a CGAffineTransformTranslate and something else. But I don't see a CGAffineTransform which allows me to transition to another UIImage.
The only way I know to animate between images is to use the UIImageView animationImages array combined with startAnimating. However, I don't know how to combine this with a translation like so:
UIImageView* textView = [[UIImageView alloc] initWithFrame:bunnyImage.frame];
textView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:#"bunnyclose.png"],
[UIImage imageNamed:#"bunnytalk.png"],
nil];
textView.animationDuration = 1.0;
textView.animationRepeatCount = 8;
[textView startAnimating];
[self.view addSubview:textView];
Any suggestions?
In answer to my own question, the block animation function transitionFromView:toView:duration:options:completion as discussed in "Creating Animated Transitions Between Views" is the best solution that I have come up with yet. I use this to animate between images and this can be combined with the block animation animateWithDuration:delay:options:animations:completion: using CGAffineTransformTranslate or simply by changing the center of the UIImageView as discussed in Animations.
Reworking my original codeblock and adding my translation looks something like this:
UIImageView* bunny2View = [[UIImageView alloc] initWithFrame:bunny2Image.frame];
[UIView
transitionFromView:bunny2Image
toView:bunny2View
duration:10.0
options:UIViewAnimationOptionShowHideTransitionViews
completion:^(BOOL finished) {
[UIView
animateWithDuration:dur
animations:^(void) {
CGPoint center = bunny2Image.center;
center.y += deltay;
bunny2Image.center = center;
bunny2View.center = center;
}
completion:^(BOOL finished) {
[UIView
transitionFromView:bunny2View
toView:bunny2Image
duration:10.0
options:UIViewAnimationOptionShowHideTransitionViews
completion:nil];
}];
}];
Still a work in progress, but this is what I've come up with so far!

Image won't appear in Xcode

I'm a first time programmer and i'm trying to make a soundboard app. Its not finished yet and it is pretty basic. I have a main menu with one button. When this button is pressed, a different background image should appear along with a back button. The image does not change. here is the code:
-(IBAction)redgradient {
UIImage *img = [UIImage imageNamed:#"redgradient.jpg"];
[imageView setImage:img];
}
-(IBAction)redgradient2 {
UIImage *img = [UIImage imageNamed:#"redgradient2.png"];
[imageView setImage:img];
}
I have mentioned the IBActions in the H file and used an IBOutlet of ImageView. Help is appreciated.
Here's a more simple way to do that, test if this works better:
-(IBAction)redgradient {
imageView.image = [UIImage imageNamed:#"redgradient.jpg"];
}
-(IBAction)redgradient2 {
imageView.image = [UIImage imageNamed:#"redgradient2.png"];
}
Check if the images ends on .jpg or .png if that is the problem.
Here are a few things to check:
The image files have been added to the project.
The image names are exactly as they appear in the project (case sensitive and correct format).
The connections are properly established in the IB.

iphone: customise cell.accessoryType

hi am doing an iphone twitter app with json and i am wondering if it is possible to set the
cell.accessoryType to a image in UITableView? or possible move the image to the right hand side...any clues?
Sure. Just use the accessoryView property of UITableViewCell and assign a UIImageView:
UIImage *image = [UIImage imageNamed:#"fileNameOfYourImage.jpg"]; //or wherever you take your image from
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
cell.accessoryView = imageView;
[imageView release];
No need to use imageview, just provide this for simple arrow.
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;

UIBarButtonType as a UIButton. Not on a NavigationBar!

I would like to use the better styled UIBarButtonType as a typical UIButton. This is just to use on a view not a navigationBar.
I don't really want to recreate the button in an image app and apply to the various states. I know how to do it the other way around so there must be a way.
Please help.
I tried this and it works :
UIButton *info = [UIButton buttonWithType:UIButtonTypeInfoLight];
UIBarButtonItem *infoBis = [[UIBarButtonItem alloc] initWithCustomView:info];
NSArray *array = [[NSArray alloc] initWithObjects:infoBis, nil];
[tool setItems:array animated:YES]; //tool = UIToolbar
don't forget to put a target on your UIBarButtonItem ;)
You cannot do that.
UIBarButtonItems are made just for UIToolbar and UINavigationBar.
You need to create your own background image. It isn't a big issue, just few lines.

Resources