小编Chi*_* Dj的帖子

如何从存储在字符串中的NSValue返回CGRect

CGRect rect = Temp_3_Artwork_Big_Image.frame;
NSLog(@"Rect : %.2f,%.2f,%.2f,%.2f",rect.origin.x,rect.origin.y,rect.size.width,rect.size.height);
NSValue *value = [NSValue valueWithCGRect:rect];
NSLog(@"Value : %@",value);
CGRect rect1 = [value CGRectValue];
NSLog(@"rect1 : %.2f,%.2f,%.2f,%.2f",rect1.origin.x,rect1.origin.y,rect1.size.width,rect1.size.height);
Run Code Online (Sandbox Code Playgroud)

输出就好

Rect : -0.00,-0.00,829.63,1241.93
Value : NSRect: {{-1.1322711e-05, -2.9491075e-05}, {829.63159, 1241.933}}
rect1 : -0.00,-0.00,829.63,1241.93
Run Code Online (Sandbox Code Playgroud)

NSValue使用解析发送到服务器.这很好用,当我从服务器上取回它时NSString就像是一样

NSRect: {{-1.1322711e-05, -2.9491075e-05}, {829.63159, 1241.933}}
Run Code Online (Sandbox Code Playgroud)

现在我怎么能把它转换成一个CGRect

ios cgrect nsvalue

3
推荐指数
1
解决办法
2274
查看次数

如何在 Swift 中制作 UILabel 数组

如何在 Swift 中制作 UILabel 数组。当我尝试这样做时,我收到一个错误,如ViewController.Type'dose not have a member named 'Lable00' 我的代码:

import UIKit

class ViewController: UIViewController {

    let individualScores = [75, 43, 103, 87, 12]

    @IBOutlet var Lable00: UILabel?
    @IBOutlet var Lable01: UILabel?
    @IBOutlet var Lable02: UILabel?
    @IBOutlet var Lable03: UILabel?
    @IBOutlet var Lable04: UILabel?

    var Lable_Arr = [Lable00, Lable01, Lable02, Lable03, Lable04]

    override func viewDidLoad() {
        super.viewDidLoad()

        for score in individualScores {
        }
        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() { …
Run Code Online (Sandbox Code Playgroud)

uikit ios swift

3
推荐指数
1
解决办法
1万
查看次数

两个数组在一个第一个数组中检索两个值

First_mutableArray1,2,3,4,5,6
Second_MutableArray2,4,6,8,0,12

如何获得这样的输出

First_mutableArray1,2,3,4,5,6,8,0,12吗?

iphone nsmutablearray ios

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

以编程方式将图像600x600调整为100x100

我有高度为600的图像,宽度也是600现在我想在UIImageView中用100x100以编程方式显示该图像.我尝试但是图像不像原始图像我添加图像的屏幕截图首先是100x100,第二个是200x200.第二个很好.但是第一个不像原始图像.知道我做什么请在此输入图像描述

in.h中

@interface ViewController : UIViewController
{
    IBOutlet UIImageView *imageView1;
    IBOutlet UIImageView *imageView2;
}
@end
Run Code Online (Sandbox Code Playgroud)

In.m

- (void)viewDidLoad
{
    [super viewDidLoad];
    imageView1.frame=CGRectMake(100, 50, 100, 100);
    imageView2.frame=CGRectMake(50, 200, 200, 200);
    imageView1.image = [UIImage imageNamed:@"Untitled-7.png"];
    imageView2.image = [UIImage imageNamed:@"Untitled-7.png"];
}
Run Code Online (Sandbox Code Playgroud)

原始图像是600x600

iphone objective-c

1
推荐指数
3
解决办法
1万
查看次数

标签 统计

ios ×3

iphone ×2

cgrect ×1

nsmutablearray ×1

nsvalue ×1

objective-c ×1

swift ×1

uikit ×1