草庐IT

iphone - 您如何检查 uiview 何时出现在屏幕上/完成绘图?

我似乎在使用drawrect方法时遇到了一些问题。我正在使用CGContextDrawPDFPage将PDF页面绘制到View上,然后我希望在View的框架加载后运行UIView动画。但是,如果我在drawrect方法的末尾调用动画,它会导致动画不稳定,因为动画在UIView实际出现在屏幕上之前(有时是2秒后)已经过了它的持续时间。我正在寻找一种方法来检查View是否已完成绘制。任何想法或帮助将不胜感激?这是我的代码...-(void)drawRect:(CGRect)inRect{pageRef=[[PDFManagersharedManager]getLargePDFPageRef

iphone - 如何根据拖动角边的比例调整 UIView 的大小?

我有一个具有一定尺寸的UIView。我正在调整单击按钮时的View大小。但是UIView的大小调整取决于3:2、4:3、16:9等比例。而且UIView的拖动一定要按照比例进行。kResizeThumbSize30-(void)touchesBegan:(NSSet*)toucheswithEvent:(UIEvent*)event{UITouch*touch=[[eventallTouches]anyObject];if([((UIView*)(touch.view))isEqual:canvas]){touchStart=[[touchesanyObject]locationInV

ios - 在 touchesMoved 期间取消触摸事件

我需要在touchesMoved期间取消触摸事件,以便底层uiview可以接收事件。请参阅以下评论:-(void)touchesMoved:(NSSet*)toucheswithEvent:(UIEvent*)event{for(UITouch*touchintouches){if(touch.view==self.touchOverlay){CGPointtouchLocation=[touchlocationInView:touch.view];//performchecksontouchlocationandtripsensorifcircumstancesaremetif(se

iphone - 如何自定义 UIAlert View..?

我通过添加图像自定义了UIViews,使其看起来像单选按钮或复选框,但对于我的规范,我想让UIAlertView看起来像这样。..任何人都可以建议如何做到这一点?谢谢! 最佳答案 您可以设计自定义View,并可以使用此代码为其提供动画作为警报View-(void)initialDelayEnded{alert_upload.transform=CGAffineTransformScale(CGAffineTransformIdentity,0.001,0.001);alert_upload.alpha=1.0;[UIViewbegi

ios - UIView 在设备旋转后停止动画

我有一些View和ImageView。_contentView=[[UIViewalloc]initWithFrame:self.bounds];_contentView.autoresizingMask=UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;....UIImageView*imageView=[[UIImageViewalloc]initWithImage:someImage];[_contentViewaddSubview:imageView];这个imageView运行一些动画。[UIVi

iphone - 使用 CAAnimation 检测正在动画的 uiview subview 的触摸

我正在尝试检测动画View的UISubview上的触摸这是我的检测代码://simplebutnotveryelegantwayofgettingcorrectframeCGRectkeepFrame=self.fishContainer.layer.frame;self.fishContainer.layer.frame=[[self.fishContainer.layerpresentationLayer]frame];//gettouchlocation,takingpresentationlayerintoaccount.(Seeabove)CGPointp=[senderlo

ios - 应该停止从 xibs 加载 UIView 吗?

自从iOS5.0引入了childViewControllers的概念,似乎无所不能,我习惯了从xib文件加载的UIView。我通常会使用UIView并让它包含xib文件中的所有其他内容的场景。如果有任何Delegate和DataSources需要实现,UIView用于加载。使用这样的东西:NSArray*nibsArray=[[NSBundlemainBundle]loadNibNamed:@"ABCustomLoginView"owner:selfoptions:nil];if(nibsArray&&[nibsArraycount]>0){self=[[nibsArrayobject

ios - 如何使用从 iOS 中的服务器获取的 URL 在 UIView 中播放视频

我想通过从服务器的JSON响应中获得的URL在我的UIView中播放视频。这是我为播放视频而编写的代码,但没有任何反应。NSURL*movieURL=[NSURLURLWithString:objAlbum.strVideoURL];MPMoviePlayerController*moviePlayerController=[[MPMoviePlayerControlleralloc]initWithContentURL:movieURL];[moviePlayerController.viewsetFrame:self.movieView.bounds];[self.movieVie

ios - 使用自动布局将 UIView 固定在 UINavigationBar 下方

我需要使用自动布局将UIView固定在UINavigationBar(由UINavigationController拥有)下方。这里棘手的是UIView需要是UIApplication的主UIWindow的subview。插入的View需要跟踪导航栏的位置,例如,如果iOS状态栏增长到双倍高度(例如在绿色的“返回通话”场景中),或者在横向View中改变高度。该解决方案还需要使用透明的UINavigationBar,其中ViewController的edgesForExtendedLayout未设置为None。 最佳答案 您是否按照t

ios - 边框逐渐淡出的圆形 UIView

我已经成功地制作了一个像这样具有径向渐变颜色的圆圈:@interfaceCircleView:UIView@end@implementationCircleView-(void)drawRect:(CGRect)rect{constCGContextRefcontext=UIGraphicsGetCurrentContext();CGColorSpaceRefcolorSpace=CGColorSpaceCreateDeviceRGB();NSArray*gradientColors=[NSArrayarrayWithObjects:(id)[UIColorredColor].CGCo