标签: uiimage

UIImageView图像没有显示出来

_topBar = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 45)];

UIImageView *bar = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"top_bar.png"]];
bar.frame = CGRectMake(0, 0, 320, 45);
[_topBar addSubview:bar];

_up = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"up.png"]];
[_topBar addSubview:_up];
Run Code Online (Sandbox Code Playgroud)

_up没有显示在我的构建中.如果我为我的资源文件夹中的任何其他图像交换"up.png",它会显示,但up.png拒绝.有什么我能做的吗?我只使用UIImage,静态分配的UIImageView初始化它,删除并重新添加.png文件,将它们从资源文件夹中取出并放在其他地方,重新保存它们,除了抛出它们之外的所有内容.

编辑: 该文件保存为up.png但真的是up.png.psd.只是阅读细则的问题.

uiimageview uiimage ios

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

如何使UIImageView加载视网膜和非视网膜图像

我是iOS编程的新手,我不知道如何根据运行应用程序的屏幕制作UIImageView加载内容.在我的情况下,我有一个100帧动画.是否可以使用代码自动缩放非视网膜显示器的图像(图像分辨率为640x960)?谢谢!!

xcode uiimageview uiimage retina-display

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

UIView中的UIImage并显示图像部分超出范围

我在子视图中有一个比自己的子视图更大的图像,是否可以显示超出子视图的图像部分!试过了

view.clipsToBounds=NO; 
Run Code Online (Sandbox Code Playgroud)

但不缺.

到目前为止,这是我的代码的一部分.

xRayView = [[XRayView alloc] initWithFrame: CGRectMake((1024 - 800) / 2, self.device.frame.origin.y - 26, 800,530)];
        xRayView.clipsToBounds=NO;
        [xRayView setForgroundImage: [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource: @"xray_foreground_01" ofType: @"png"]]];
        [xRayView setBackgroundImage: [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource: @"xray_background_01" ofType: @"png"]]];
Run Code Online (Sandbox Code Playgroud)

前景和背景图像比X射线视图大

在XrayView中我有2个属性

backgroundImage foregroundImage

那个方法

- (void)drawRect: (CGRect)rect
{
    [super drawRect: rect];

    CGRect forgroundClips[] = {
        CGRectMake((self.frame.size.width - self.forgroundImage.size.width)/2, 0, self.forgroundImage.size.width, currentPan.origin.y),
        CGRectMake((self.frame.size.width - self.forgroundImage.size.width)/2, currentPan.origin.y + currentPan.size.height, self.forgroundImage.size.width, self.forgroundImage.size.height - (currentPan.origin.y + currentPan.size.height))
    };

    CGContextSaveGState(UIGraphicsGetCurrentContext());
    CGContextTranslateCTM(UIGraphicsGetCurrentContext(), 0, self.bounds.size.height);
    CGContextScaleCTM(UIGraphicsGetCurrentContext(), 1, …
Run Code Online (Sandbox Code Playgroud)

objective-c uiview uiimage ios

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

使用GestureRecognizers操作UIImage - 不是UIImageView

使用Pan,Pinch和Rotate等手势识别器,是否可以在UIImageView中操作UIImage?

每当我尝试为UIImage定义手势识别器时,我都会收到错误消息

没有可见的UIImage支持'addGestureRecognizer:'

使用此代码:

UIRotationGestureRecognizer *rotateGesture = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(rotateImage:)];
[imageStrip addGestureRecognizer:rotateGesture];
Run Code Online (Sandbox Code Playgroud)

无论如何在不转换UIImageView的情况下在UIImageView内部转换UIImage?

objective-c uiimageview uiimage ios

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

在xcode中将字节数组转换为图像?

我在对象中得到一个字节数组(我估计)NSMutableArray's.NSMutableArray我得到的是从Xml服务URL解析..现在我需要UIImage通过谷歌将该字节数组转换为..Gone并发现转换为NSData然后UIImage但不能懂得怎么样?我该怎么做 ?

我的数组看起来像这样:

(
{
        Name = "John";
        Image = "/9j/4AAQSkZJRgABAQAAAQABAAD//gA7Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJS
kcgSlBFRyB2NjIpLCBxdWFsaXR5ID0gODAK/9sAQwAGBAUGBQQGBgUGBwcGCAoQCgoJCQoUDg8MEBcUGBgXF
BYWGh0lHxobIxwWFiAsICMmJykqKRkfLTAtKDAlKCko/9sAQwEHBwcKCAoTCgoTKBoWGigoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgo/8AAEQgEKwZAAwEiAAIRAQMRAf/........
 //big byte array 
}
)
Run Code Online (Sandbox Code Playgroud)

首先,我需要清楚它是否是一个字节数组?如何从中提取图像?

iphone xcode uiimage

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

使用imageNamed在设备上失败,但在模拟器中工作

这是我的代码:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];

    NSArray *filePathsArray = [[NSFileManager defaultManager] subpathsOfDirectoryAtPath:documentsDirectory  error:nil];
    NSMutableArray *finalArray = [(NSArray*)filePathsArray mutableCopy];
    NSFileManager *fm = [NSFileManager defaultManager];
    NSArray *files = [fm contentsOfDirectoryAtPath:documentsDirectory error:nil];
    NSString *fileFirst = [files objectAtIndex:0];
    NSString *fullPath = [NSString stringWithFormat:@"%@/%@", documentsDirectory, fileFirst];
    /* NSUInteger index = [finalArray indexOfObject:@".DS_Store"];
    [finalArray removeObjectAtIndex: index]; */
    //NSLog(@"files array %@", finalArray);
    NSString …
Run Code Online (Sandbox Code Playgroud)

objective-c uiimage ios

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

Objective-C类别"无法识别的选择器"错误

我制作了一个UIImage Objective C类别来容纳这个功能:

    #import "UIImage+fixOrientation.h"

@implementation UIImage (fixOrientation)

- (UIImage *)fixOrientation
{

    // No-op if the orientation is already correct
    if (self.imageOrientation == UIImageOrientationUp) return self;

    // We need to calculate the proper transformation to make the image upright.
    // We do it in 2 steps: Rotate if Left/Right/Down, and then flip if Mirrored.
    CGAffineTransform transform = CGAffineTransformIdentity;

    switch (self.imageOrientation) {
        case UIImageOrientationDown:
        case UIImageOrientationDownMirrored:
            transform = CGAffineTransformTranslate(transform, self.size.width, self.size.height);
            transform = CGAffineTransformRotate(transform, M_PI);
            break;

        case UIImageOrientationLeft:
        case UIImageOrientationLeftMirrored:
            transform …
Run Code Online (Sandbox Code Playgroud)

iphone uiimage nsdata objective-c-category ios6

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

核心数据和每个对象的唯一UIImage

我正在创建一个简单的应用程序,用户可以创建使用CoreData保存的多个对象.

我的问题是,我希望每个对象都有一个链接到它的图像.图像由iphone相机或用户个人相机胶卷带来,因此图像将具有相当高的重量(我认为每个> 1MB).我读到当图像的权重很高时,处理这个问题的好方法是将图像保存在documentsDirectory文件夹中,并保存到coreData的路径.我很容易实现这一点.

但是如何找到要链接到唯一对象的图像的路径名?CoreData并没有真正处理唯一的ID,并且两个对象可以具有相同的名称...我搜索了objectID,但它的工作效果并不好,我不确定这是处理这个问题的好方法.

你有什么主意吗?还有一种我完全失踪的简单方法吗?先感谢您.

core-data objective-c save uiimage ios

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

如何在IOS 6中获得此背景条?

在此输入图像描述

我在旧版本中使用了这个背景,在更新到iOS 6.0后我无法在IB中找到任何地方.我堆栈溢出并使用它

self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
Run Code Online (Sandbox Code Playgroud)

它仍然是白色,我现在该怎么办?我需要为此设置图像吗?

iphone cocoa-touch uiview uiimage ios

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

在ios中更改视图的背景图像

我有一类像这样的键盘:

@implementation Testkeyboard 

 -(void)drawRect:(CGRect)rect
 {

    UIImage *image = [UIImage imageNamed: @"FrameLetters2.png"];
    [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];  
 }
Run Code Online (Sandbox Code Playgroud)

我想创建一些方法来改变这样的背景*图像

  -(void) changeImage1

  -(void) changeImage2
Run Code Online (Sandbox Code Playgroud)

如何实施?

提前致谢.

iphone objective-c uiimage ios

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