내가 뭘하고 싶은지 : 배열의 항목이 레이블에 표시됩니다. 배열의 각 항목에는 자체 레이블이 있습니다. 결국 나는 더 많은 항목을 추가하고 싶습니다.배열 및 추가
그리고 thisArray의 인덱스 0을 해당 배열의 인덱스 0에 추가 할 수 있도록하십시오. 라벨에 표시; thisArray의 인덱스 1에있는 객체를 해당 Array의 인덱스 1에있는 객체에 추가 한 다음 결과를 별도의 레이블 등과 같이 표시 할 수 있습니다. 버튼 클릭으로 표시됩니다.
나는 이것을 구현하는 데 많은 어려움을 겪고 있으며, 나는 그것을 만드는 것보다 훨씬 더 간단하다고 느낀다. 모든 통찰력은 appreicated 것입니다!
#import "ViewController.h"
@interface ViewController()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.steakArray = [[NSArray alloc] initWithObjects: @"800", @"50", nil];
//NSString *name;
NSString *calories = [_steakArray objectAtIndex:0];
NSString *fat = [_steakArray objectAtIndex:1];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
//this doesn't work, this is what I want to have happen though.
//click button, show this in label.
- (IBAction)steak:(id)sender {
self.infoLabel.text = calories, fat;
}
@end
왜 칼로리 카운트가 문자열로 유지되는지 티파니? – rmaddy
내가 뭘하는지 전혀 모르니까. – Kate
"추가"라고 말하면 실제로 숫자 추가를 의미합니까, 아니면 문자열과 같이 추가 된 것을 의미합니까? –