标签: uiimageview

如何设置使用导航控制器添加的TableView的背景图像 - Swift 1.2

我想TableView通过在场景中添加导航控制器来设置背景图像.

我尝试使用a UIImageView但无法找到将其放在层次结构中的位置.

UIImageView在这种情况下是否可以添加via Storyboard?

提前致谢

如果我UIImage在层次结构中,我得到了这个 在此输入图像描述

iphone uitableview uiimageview ios swift

0
推荐指数
1
解决办法
5245
查看次数

在UIImageView上绘制而不替换其原始图像iOS

此代码对imageview进行了更改,但它替换了原始图像.我需要在原始图像上进行编辑而不是替换它.

- (void)drawShapes {
    //NSLog(@"In drawShapes!");

    UIGraphicsBeginImageContext(self.planView.frame.size);
    CGContextRef context = UIGraphicsGetCurrentContext();

    for(myShape *i in _collection) {
        [self drawShapesSubroutine:i contextRef:context];
        if(i.selected == true) {
            CGContextSetLineWidth(context, 1.0f);
            CGContextSetStrokeColorWithColor(context, [[UIColor darkGrayColor] CGColor]);
            float num[] = {6.0, 6.0};
            CGContextSetLineDash(context, 0.0, num, 2);

            CGRect rectangle;
            [self drawShapeSelector:i selectorRect: &rectangle];
            CGContextAddRect(context, rectangle);
            CGContextStrokePath(context);


            //tapped = true;
        }
    }

    if(!skipDrawingCurrentShape && (selectedIndex == -1)) {
        [self drawShapesSubroutine:_currentShape contextRef:context];
    }
    self.planView.image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
}
Run Code Online (Sandbox Code Playgroud)

当我删除此行时:

self.planView.image = UIGraphicsGetImageFromCurrentImageContext();
Run Code Online (Sandbox Code Playgroud)

图像不会消失但也不会消失.我需要绘制而不删除原始照片.

core-graphics objective-c uiimageview ios

0
推荐指数
1
解决办法
419
查看次数

cell.imageView!.frame size change.迅速

单击单元格后,我找不到为什么cell.imageView会发生变化的原因.似乎只有宽度变化.在我的代码中,图像框架应该是第二张图片中的iPhone.

imageView是Swift内置的,而不是tableviewcell的自定义名称.

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
    if tableView == resultsTable {
        let cell: UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "MarketCell")
        var supplyDetail = String()

        var frame = cell.imageView!.frame
        let imageSize = 50 as CGFloat
        frame.size.height = imageSize
        frame.size.width  = imageSize
        cell.imageView!.frame = frame
        cell.imageView!.layer.cornerRadius = imageSize / 2.0
        cell.imageView!.clipsToBounds = true

        cell.imageView?.image = UIImage(named: "Profile Picture")
        ...getDataInBackgroundWithBlock...
            cell.imageView?.image = UIImage(data: data!)!
        return cell

    } 
}
Run Code Online (Sandbox Code Playgroud)

点击之前,

在此输入图像描述

点击后,

在此输入图像描述

image cell uitableview uiimageview swift

0
推荐指数
1
解决办法
5750
查看次数

对iOS UIImage的Prisma效果

我正在制作一个照片应用程序,我必须在UIImage上应用prisma效果.但是仍然没有得到任何关于这种效果的参考.

作为参考,您可以看到这个应用程序.

https://itunes.apple.com/us/app/prisma-art-filters-photo-effects/id1122649984?mt=8

是否有任何关于prisma效果的图书馆或参考?

xcode objective-c core-image uiimageview ios

0
推荐指数
1
解决办法
2553
查看次数

使UIImageView成为圆形,在边框周围添加边框和阴影

我知道有类似的问题,但没有找到帮助我解决我的问题的答案.如果您已经看过一个,请随意将其标记为重复,但请确保它回答整个问题,而不仅仅是类似的部分.

我有一个UIImageView,我正在修改角落并为其添加边框.但是,我开始添加一些阴影以给我的UI一些深度.我正在为我的个人资料图片添加一个阴影,以下代码非常适合一个完美的方形图像,它会被裁剪成一个完美的圆圈.但是,对于非方形矩形图像,阴影应用于图像本身而不是图像视图,因此我最终在裁剪的矩形图像周围出现圆形边框,其边缘周围有阴影,无法到达圆形边界.有关如何修改我的代码以将此阴影应用于边界而不是UIImageView中的图像的任何见解?

谢谢

//Set profile image view to be rounded (default appears rounded due to alpha background, need rest to appear rounded as well
[self.profileImageView layoutIfNeeded];
CALayer *imageLayer = self.profileImageView.layer;
[imageLayer setCornerRadius:self.profileImageView.frame.size.width/2];
[imageLayer setBorderWidth:1];
[imageLayer setBorderColor:[[UIColor colorWithRed:78.0/255.0 green:82.0/255.0 blue:85.0/255.0 alpha:1] CGColor] ];
[imageLayer setMasksToBounds:YES];

//Apply shadows to necessary views for the job badge
[self.profileImageView.layer setShadowColor:[[UIColor blackColor] CGColor]];
[self.profileImageView.layer setShadowRadius:4.0f];
[self.profileImageView.layer setShadowOffset:CGSizeMake(0, -3)];
[self.profileImageView.layer setShadowOpacity:0.5f];
Run Code Online (Sandbox Code Playgroud)

objective-c shadow uiimageview ios

0
推荐指数
1
解决办法
3265
查看次数

如何快速从左向右移动图像?

我做到了

屏幕截图

ivImageLoadingInside.center = CGPoint(x: 25, y: 0)
   UIView.animate(withDuration: 2, delay: 0, options: .repeat, animations: {
   self.ivImageLoadingInside.center = CGPoint(x: 80, y: 0)
}, completion: nil)
Run Code Online (Sandbox Code Playgroud)

但是总是停在中间。

这是带有动画的图像

屏幕截图

animation uiimageview swift

0
推荐指数
1
解决办法
7128
查看次数

UIImageView无法识别我的点击事件

我有一个UIImageView我这样创建的:

let tap = UITapGestureRecognizer(target: self, action: #selector(test))

let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 150, height: 150))
imageView.image = UIImage(named: "Test")
imageView.addGestureRecognizer(tap)
self.view.addSubview(imageView)
Run Code Online (Sandbox Code Playgroud)

但是,test当我点击它时,某种程度上不会调用该函数...似乎我已经尝试了所有东西,但它不起作用.有什么建议吗?

uiimageview ios uitapgesturerecognizer swift

0
推荐指数
1
解决办法
494
查看次数

出口无法连接重复内容UIImageView错误?

我收到一条错误,指出"从ViewController到UIImageView的imageView插座无效.插座无法连接到重复内容"我在故事板上的tableViewCell中添加了一个imageView.我该怎么做才能解决这个问题?

@IBOutlet weak var imageView: UIImageView!

var posts = [postStruct]()




override func viewDidLoad() {
    super.viewDidLoad()




    let ref = Database.database().reference().child("Posts")

    ref.observeSingleEvent(of: .value, with: { snapshot in

        print(snapshot.childrenCount)

        for rest in snapshot.children.allObjects as! [DataSnapshot] {

            guard let value = rest.value as? Dictionary<String,Any> else { continue }

            guard let  title = value["Title"] as? String else { continue }
            guard let  downloadURL = value["Download URL"] as? String else { continue }
            self.imageView.sd_setImage(with: URL(string: downloadURL), placeholderImage: UIImage(named: "placeholder.png"))
            let post = postStruct(title: title)

            self.posts.append(post)


        } …
Run Code Online (Sandbox Code Playgroud)

image uitableview uiimageview swift swift3

0
推荐指数
1
解决办法
1405
查看次数

Swift 3在同一个UIView中放了2种颜色

我想在UIViews和UIImageViews上实现这个效果:

的UIImageView

的UIView

在UIView上,我知道我可以用不同的颜色在其中放置2,但我认为必须有更好的方法,我不知道如何在UIImageVIew中做到这一点.某种pod会非常有用,因为我找不到它.

uiview uiimageview ios swift

0
推荐指数
1
解决办法
2430
查看次数

在圆形UIImageView中获取压缩的图像

我正在制作个人资料照片.

我在故事板上添加了一个UIImageView(比如userImageView),方面模式为SCALE TO FILL并在我的swift文件中添加了以下代码

self.userImageView.layer.borderWidth = 10
self.userImageView.layer.borderColor = UIColor.white.cgColor
self.userImageView.layer.cornerRadius = self.userImageView.frame.height/2
self.userImageView.clipsToBounds = true
Run Code Online (Sandbox Code Playgroud)

但是当试图从相机或相册添加图像时,图像会被压缩.

我也试图调整图像大小,但仍然,图像正在压缩.

我究竟做错了什么?

uiimageview ios swift

0
推荐指数
1
解决办法
48
查看次数