iphone - 带有按钮的 UIscrollview 中的动画
<p><p>我已经尝试过 iCarousel,并将其添加到我的项目中。我能够放置图像。现在我正在尝试实现一种方法,当单击按钮时,轮播将旋转。
我试过这段代码:</p>
<pre><code>- (IBAction) spinButton:(id)sender
{
;
;
;
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:carousel
cache:YES];
;
;
}
</code></pre>
<p>但似乎只有轮播 View 有动画效果。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>以下两种方法更改aries可能是您正在解决的问题,</p>
<pre><code>-(void)TappedButton:(UIButton *)sender{
UIView *view=;
;
;
;
;
// ;
;
NSLog(@"%d",sender.tag);
}
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view
{
UILabel *label = nil;
//create new view if no view is available for recycling
if (view == nil)
{
view = [[ initWithImage:] autorelease];
// label = [[ initWithFrame:view.bounds] autorelease];
// label.backgroundColor = ;
// label.textAlignment = UITextAlignmentCenter;
// label.font = ;
//
// ;
UIButton *buttonForDisplay = [[ initWithFrame: view.bounds] autorelease];
buttonForDisplay.backgroundColor=;
forState:UIControlStateNormal];
buttonForDisplay.titleLabel.font = ;
;
;
buttonForDisplay.tag = index;
/// view.tag=index;
;
}
else
{
label = [ lastObject];
}
//set label
//label.text = [ stringValue];
return view;
}
</code></pre>
<p><strong>编辑</strong>
这个方法通过你可以捕捉到轮播 View 的引用。</p>
<pre><code>- (UIView *)itemViewAtIndex:(NSInteger)index
</code></pre>
<p><strong>用动画编辑</strong> </p>
<pre><code>UIViewController *nextViewController = [ autorelease];
nextViewController.view.backgroundColor = ;
CATransition *animation = ;
animation.duration = 3.5;
animation.timingFunction = ;
animation.type = kCATransitionPush;
animation.subtype = kCATransitionFromTop;
;
;
</code></pre></p>
<p style="font-size: 20px;">关于iphone - 带有按钮的 UIscrollview 中的动画,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/10222386/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/10222386/
</a>
</p>
页:
[1]