Tag: uiview

为什么移动UIView不移动UIImageView在同一视图?

我有一个UIView上的ImageView。 我试图移动视图键盘大小,但所有的内容正常,而不是UIImageView移动。 -(void) keyboardWillShow:(NSNotification *) notification { NSDictionary* keyboardInfo = [notification userInfo]; // Work out where the keyboard will be NSValue* keyboardFrameBegin = [keyboardInfo valueForKey:UIKeyboardFrameBeginUserInfoKey]; CGRect keyboardFrameBeginRect = [keyboardFrameBegin CGRectValue]; // Work out animation duration NSTimeInterval animationDuration =[[keyboardInfo valueForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue]; UIViewAnimationOptions keyboardAnimationCurve = [[keyboardInfo valueForKey:UIKeyboardAnimationCurveUserInfoKey] integerValue]; // Animate this [UIView animateWithDuration:animationDuration delay:0.0 options:keyboardAnimationCurve animations:^(){ self.view.frame […]

UIView阴影,cornerradius不工作

@IBOutlet weak var selectorSemiView: UIView! @IBOutlet weak var blurEffect: UIVisualEffectView! @IBOutlet var outerAreaRecognizer: UITapGestureRecognizer! override func viewDidLoad() { super.viewDidLoad() selectorSemiView.layer.cornerRadius = 15 selectorSemiView.layer.shadowColor = UIColor.gray.cgColor selectorSemiView.layer.shadowOffset = CGSize.zero selectorSemiView.layer.shadowRadius = 7 } selectorSemiView是一个容器视图 当我运行这个应用程序,没有阴影,没有圆angular。 我的代码有什么问题?

自定义UITableViewCell中的自定义UIView

我需要两个自定义(即子类)的UIViews在子类UITableViewCell中,如下图所示。 这两个UIViews是相同的子类。 自定义的UIViews和TableViewCell都有关联的xib。 我将不胜感激关于这个最好的方式的一些build议。 我这样加载TableViewCell。 – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath (NSIndexPath *)indexPath { static NSString *CellIdentifier = @"CustomCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:NULL]; // CustomCell is an IBOutlet connected to the above nib cell = BLCustomCell; } // configure the cell } 我想在自定义视图中设置sockets,以便轻松显示来自我的数据模型的数据。 我需要一个视图控制器的自定义视图? 我无法获取自定义视图加载的笔尖。 […]

检测一个UIView是否在父亲的另一个UIView后面

我有一个家长UIView几个子视图。 子视图是兄弟姐妹 – 子视图不是彼此的子视图。 (在他们的超级观点中,每个人都处于相同的等级水平) 例如: UIView *containerView = [[UIView alloc] initWithFrame:frame]; CustomUIView *childView = [[UIView alloc] initWithFrame:anotherFrame]; CustomUIView *yetAnotherChildView = [[UIView alloc] initWithFrame:anotherFrame]; [containerView addSubview:childView]; [containerView addSubview:yetAnotherChildView]; [containerView bringSubviewToFront:childView]; 我想要yetAnotherChildView能够检测到它被移回到视图的层次结构中。 如何才能做到这一点? 编辑 : 我明白, containerView可以知道什么子视图上面是什么 – 但我不想(不能) containerView视图通知其子视图,他们的顺序改变 – 想象一下,添加一个股票视图上的子视图 – 股票视图有不知道它的子视图,他们希望收到这样的通知。 子视图CustomUIView将需要观察其CustomUIView一些变化 例如(这可能是一个非常糟糕的解决scheme) CustomUIView -(id)initWithFrame { [self.superView addObserver:self forKeyPath:@"subViews" options:options context:context]; } – […]

如何使CAShapeLayer中的dynamicstrokeColor? 在Swift中

我使用六个参数(活动,不活动,有线,压缩,免费和总计)。 我做了一个CAShapeLayer类,我在那里做了一个function,我可以绘制圆只是添加参数的帮助。 我制作了CGPath并且在绘制一个圆圈的函数中添加了六次。 我得到了5层到UIView 。 我做了一秒钟更新数据的定时器,但它添加其他5层到UIView 。 这是错误的方式。 我想用数据animation弧,并在一秒钟内更新。 当层变得太多设备工作缓慢。 我怎样才能做到这一点? 我在这里写了我的例子。 public class Arc { public init() { } public func addFigure(path: CGPath, fillColor: UIColor, strokeColor: UIColor, strokeStart: CGFloat, strokeEnd: CGFloat, lineWidth: CGFloat, miterLimit: CGFloat, lineDashPhase: CGFloat, layer: CALayer) -> CAShapeLayer { let shape = CAShapeLayer() shape.path = path shape.fillColor = fillColor.CGColor shape.strokeColor = […]

如何使UIView作为滚动视图工作

我需要一些严重的帮助,我需要将UIView作为ScrollView 。 下载图片将清除所有的疑惑。 我已经采取了四个button以及他们下面的UIView以及4个容器视图,我已经把一个在另一个之上,以便与四个button一起工作..我现在想要的是将UIView作为ScrollView 。 每当我点击任何button,视图向前移动以及它改变容器视图。 每当我点击一个button,相应的容器视图。

重叠不同颜色和Alpha的UIViews

有没有办法重叠2个或更多的UIViews与不同的背景颜色和alphas给出另一种颜色的外观? 例如,在一个蓝色的UIView顶部放置一个红色的UIView ,以给出一个洋红色的UIView的外观。

可滚动的背景图像,并与UITable滚动同步

我已经使用下面的代码将图像添加到UITableview。 我无法弄清楚如何让背景图像与表格滚动(不是每个单元格中的图像,而是UITable后面的大图像)。 我需要背景图像滚动,并与UITable滚动同步。 我search了所有我见过的例子,只是添加一个静态图像。 这是代码: [self.view setBackgroundColor: [UIColor colorWithPatternImage: [UIImage imageWithContentsOfFile: [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent: @"background.png"]]]]; 谢谢你的帮助。

用基于百分比的颜色填充UIView

我有一个UIView UIView内UIViewController与高度= 149.0和宽度= 123.5。 我用这个颜色来填充这个UIView,并且我根据从一个剩余url的百分比响应来设置要填充的颜色的高度。 如何填充整个视图以上面提到的尺寸为100%和不同的值。 任何帮助将不胜感激。 谢谢

EAGLView到UIImage计时问题

我有一个EAGLView,我想转换成一个UIImage。 我可以用这里发布的解决scheme来做到这一点: 如何从EAGLView获取UIImage? 但是,如果在创buildEAGLView和UIImage之间经过一段时间,我只能做到这一点。 这个代码创build了一个EAGLView,然后是一个UIImageView,但是不能正常工作: EAGLView *EAGLphoto = [[EAGLView alloc] initWithImage:photo.workAreaImage]; [theWorkArea.photoArea1 addSubview:EAGLphoto]; //I put a glfinish() here but it didn't help UIImageView *photoView = [[UIImageView alloc] initWithImage:[self glToUIImage]]; //glToUIImage is taken from the link above [theWorkArea.photoArea2 addSubview:photoView]; 我假设UIImageView尝试在EAGLView完成创build之前创build。 我试图把glfinish()放在中间,但是什么也没做。 当我运行代码时,EAGLView显示正常,但UIImageView显示为黑色。 但是,上述代码的这个修改版本的工作原理是: EAGLView *EAGLphoto = [[EAGLView alloc] initWithImage:photo.workAreaImage]; [theWorkArea.photoArea1 addSubview:EAGLphoto]; [self performSelector:@selector(getUIImage) withObject:nil afterDelay:0.1]; – […]