我有一个滚动视图,那里有几个按钮/图像.点击我想要这样的动画:
(图像打开像)书籍封面打开,相关的视图控制器在动画中轻松打开并获得全屏.
有什么想法吗 ?
在厨师应用程序中发生类似的事情厨师应用程序链接:https://itunes.apple.com/us/app/cook/id687560846?mt = 8
编辑:我添加了动画,gif将在完全加载后不间断运行.
我有一系列图像,我想通过在序列中依次播放这些图像来创建视频.我想在图像变化时添加不同类型的动画.建议我使用Cocoa框架在Objective-C中实现此功能的一些方法或任何解决方案.
这是制作图像视频的工作代码,但请建议我们在制作视频时如何制作图像动画:
-(void)createVideoFromImages:(NSString *) path withSize:(CGSize) size
{
NSError *error = nil;
AVAssetWriter *videoWriter = [[AVAssetWriter alloc] initWithURL:
[NSURL fileURLWithPath:path] fileType:AVFileTypeMPEG4
error:&error];
NSParameterAssert(videoWriter);
NSDictionary *videoSettings = [NSDictionary dictionaryWithObjectsAndKeys:
AVVideoCodecH264, AVVideoCodecKey,
[NSNumber numberWithInt:size.width], AVVideoWidthKey,
[NSNumber numberWithInt:size.height], AVVideoHeightKey,
nil];
AVAssetWriterInput* videoWriterInput = [AVAssetWriterInput
assetWriterInputWithMediaType:AVMediaTypeVideo
outputSettings:videoSettings];
AVAssetWriterInputPixelBufferAdaptor *adaptor = [AVAssetWriterInputPixelBufferAdaptor
assetWriterInputPixelBufferAdaptorWithAssetWriterInput:videoWriterInput
sourcePixelBufferAttributes:nil];
NSParameterAssert(videoWriterInput);
NSParameterAssert([videoWriter canAddInput:videoWriterInput]);
videoWriterInput.expectsMediaDataInRealTime = YES;
[videoWriter addInput:videoWriterInput];
//Start a session:
[videoWriter startWriting];
[videoWriter startSessionAtSourceTime:kCMTimeZero];
//Video encoding
CVPixelBufferRef buffer = NULL;
//convert uiimage to CGImage.
int frameCount = 0;
for(int i …
Run Code Online (Sandbox Code Playgroud) 我有一个表视图,它使用来自AFNetworking的延迟加载和占位符图像来显示图像.我正试图在加载时尝试从占位符淡入图像.我的代码在这里工作,但是如果在滚动表格时加载图像,则一切看起来很奇怪,并且表格停止滚动.同样的事情发生在具有相同效果的水平滚动条上.
这是我在cellForRowAtIndexPath中使用的代码
[cell.hotelImage setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:hotelImageUrl]]
placeholderImage:[UIImage imageNamed:@"placeholder.png"]
success:^(NSURLRequest *request , NSHTTPURLResponse *response , UIImage *image ){
if (request) {
//Fade animation
[UIView transitionWithView:self.view
duration:1.0f
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{
[cell.hotelImage setImage:image];
} completion:NULL];
}
}
failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error){
}
];
Run Code Online (Sandbox Code Playgroud)
一旦图像在缓存中,我正在使用if(请求)来避免动画.
提前谢谢了.
我正在为UITableView制作动画.我希望表视图像这样滑动打开:
http://www.youtube.com/watch?v=XIGJLbiRsXE
但是,它打开如下:
http://www.youtube.com/watch?v=UJUX-ILCB_0
注意表格单元格本身是如何制作动画的.我怎么能阻止这种情况发生?
我正在使用autolayout.因此代码如下:
[theView addSubview:theTable];
[theTable reloadData];
[theTable invalidateIntrinsicContentSize];
[UIView animateWithDuration:.33 animations:^{
[theView layoutIfNeeded];
}];
Run Code Online (Sandbox Code Playgroud)
其他细节,可能会或可能不重要:
表视图的父级是scrollView
我重写了表视图的intrinsicContentSize以返回表视图中所有单元格的高度,因此表视图不会滚动
我在显示之前更改了表视图的数据源
我有以下自定义过渡使用UIView.animateWithDuration(...usingSpringWithDamping:...)
,它完美地工作.
UIView.animateWithDuration(self.transitionDuration(transitionContext),
delay: 0.0, usingSpringWithDamping: 0.8, initialSpringVelocity: 1.0,
options: nil, animations: {() in
// ...
}, completion: {(Bool) in
// ...
})
Run Code Online (Sandbox Code Playgroud)
但后来我不得不扩展我的自定义转换,UIViewControllerInteractiveTransitioning
以便进行交互式转换,用户可以再次向下滑动模态视图.
因此,我需要动画的关键帧才能UIPercentDrivenInteractiveTransition
正常工作.
所以我改变了动画功能UIView.animateWithKeyframes...
.
UIView.animateKeyframesWithDuration(self.transitionDuration(transitionContext),
delay: 0.0, options: UIViewKeyframeAnimationOptions.CalculationModeCubic,
animations: {() in
// ...
}, completion: {(Bool) in
// ...
})
Run Code Online (Sandbox Code Playgroud)
我现在的问题是:我丢失了弹簧动画.
我查了几个链接,其中最有希望的是:
...但是使用.addKeyframes...
方法我无法指定我需要的完成块.
有什么建议?: - /
我有问题transitionWithView
和animateWithDuration
.我的一个animateWithDuration
块没有转换,它是一个突然的改变,并transitionWithView
没有暂时禁用用户交互.我检查了文档,并相信我正在做的一切正确,但显然有些不对劲.以下是两段代码:
这是在我的主View Controller中ViewController
,它有三个容器视图/子视图控制器.此块移动其中一个容器视图,但在ViewController
发生转换时不会阻止用户进行其他交互.
[UIView transitionWithView:self.view duration:0.5 options:UIViewAnimationOptionCurveEaseOut animations:^ {
CGRect frame = _containerView.frame;
frame.origin.y = self.view.frame.size.height - _containerView.frame.size.height;
_containerView.frame = frame;
}completion:^(BOOL finished) {
// do something
}];
Run Code Online (Sandbox Code Playgroud)
这是我的一个容器视图控制器.动画似乎没有任何效果的文本productTitleLabel
和productDescriptionTextView
突然改变,仿佛动画块不存在.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.viewController toggleFlavoredOliveOilsTableView];
if (indexPath.row > 0) {
NSDictionary *selectedCellDict = [[_flavoredOliveOilsDict objectForKey:@"Unflavored Olive Oils"] objectAtIndex:indexPath.row - 1];
[UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionTransitionCrossDissolve animations:^ {
self.viewController.productTitleLabel.text = [_flavoredOliveOilsTableView cellForRowAtIndexPath:indexPath].textLabel.text;
self.viewController.productDescriptionTextView.text = …
Run Code Online (Sandbox Code Playgroud) 是否有任何库用于在类似于下图的ios应用程序中创建多步骤表单进度
我想调整UIView的大小,我的代码在iOS 7.1中运行得很完美,但是当我在iOS 8中运行时,它无法正常工作(我将在下面解释).
我的故事板中有我的UIView值(0,67,511,320),我想在iPad上调整到全屏,所以我添加了以下代码:
[UIView animateWithDuration:0.5 animations:^{
CGRect frame = containerView.frame;
frame.origin.x = 0;
frame.origin.y = 67;
frame.size.height = 643;
frame.size.width = 1024;
containerView.frame = frame;
...
}completion:^(BOOL finished) {
...
}];
Run Code Online (Sandbox Code Playgroud)
我想要的东西:
_________________________________
| | |
| | |
| A | |
|___________| |
| |
| BACKGROUND |
| |
| |
|_________________________________|
|
V
_________________________________
| |
| |
| |
| A |
| |
| |
| |
| |
|_________________________________|
Run Code Online (Sandbox Code Playgroud)
但它开始动画像(0,67,0,0)到(0,67,511,320)
关于发生了什么的任何线索?还是另类?
我有一个标签显示一个数字,我想将其更改为更高的数字,但是,我想为它添加一些耀斑.我想通过一个易于进出的曲线将数字增加到更高的数字,以便加速然后减慢速度.请问,如何在swift中实现这一点,这是我的代码.谢谢.
let newValue : Double = 1000
let oldValue : Double = 500
timer = NSTimer.scheduledTimerWithTimeInterval(0.1, target: self, selector: Selector("countAnimation:"), userInfo: ["oldValue":oldValue, "newValue": newValue], repeats: true)
func countAnimation(timer: NSTimer)
{
let dict = timer.userInfo as? [String:AnyObject]
var OldTotalValue : Double = (dict!["oldValue"] as? Double)!
let newTotalValue : Double = (dict!["newValue"] as? Double)!
OldTotalValue = OldTotalValue + 10
if newTotalValue < OldTotalValue
{
timer.invalidate()
}
else
{
mylabel.text = String(OldTotalValue)
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个viewController,它有一个tableView和一个mapView,只有一个是可见的.我还有一个带有分段控件的工具栏,带有两个按钮(列表和地图)
如何在表格视图和地图视图之间切换?并且重要的是工具栏将保持锁定而不用视图制作动画.
iphone objective-c uiview uianimation uiviewanimationtransition
uianimation ×10
ios ×7
objective-c ×4
iphone ×3
uiview ×3
ipad ×2
uitableview ×2
afnetworking ×1
animation ×1
autolayout ×1
avfoundation ×1
ios8 ×1
ios9.2 ×1
nstimer ×1
swift ×1
swift2 ×1
uiimageview ×1
xcode ×1
xcode7.1 ×1