我要制作看起来像这样的东西:
我有NSArray
个walking
和car
个对象。
Car
类具有NSString
属性,其中包含这些数字。
我该怎么做?感谢。
答案 0 :(得分:0)
您可以通过编程方式创建ImageView和UILabel,并将它们排列在单元格/视图中。
答案 1 :(得分:0)
您可以将UIView
创建为容器,左侧为UIImageView
,右侧为UITextView
。这将是汽车对象的模板。您的行走对象只需要一个简单的UIImageView
。然后计算您希望第一个UIImage
开始的点,并在前一个元素的末尾添加下一个容器。你也可以创建一个箭头模板,这样你只需要连接你想要的元素。看起来应该是这样的
CGFloat fHeightImage = 20.0f;
UIView *view =
[[UIView alloc] initWithFrame:CGRectMake(0, 0,
[UIScreen mainScreen].bounds.size.width,
fHeightImage)];
UIImageView *imageViewCar =
[[UIImageView alloc] initWithFrame:CGRectMake(0, 0,
fHeightImage,
fHeightImage)];
[imageViewCar setImage:[UIImage imageNamed:@"walking"]];
[view addSubview:imageViewCar];
UIImageView *imageViewArrow =
[[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetWidth(imageViewCar.frame),
CGRectGetHeight(imageViewCar.frame),
fHeightImage,
fHeightImage)];
[imageViewArrow setImage:[UIImage imageNamed:@"arrow"]];
[view addSubview:imageViewArrow];