나는 reuseIdentifier
static
여부를 내부 tableView
delegate
방법을 사용하여 tableView
메모리 할당 과정에 대해 확실하지 않다. 우리는 한 번에 [UITableViewCell alloc]
alloc
메서드를 호출하여 cellForRowAtIndexPath
방법 후 메모리에 할당되는 방법을 cell
많은 numberOfRowsInSection
방법 다음 메서드에서 반환하는 배열의 20 수를 경우있는 UITableViewCell 메모리 할당
은 가정하자.
예제 코드 : 유용한 설명뿐만 아니라 시간에 대한 감사를 이해할 수있을 것이다
(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 20; // array count
}
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil){ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:MyIdentifier];
// how many cell will be alloc here
}
// configure cell
}
.
행의 '높이'란 무엇입니까? – pkc456
@ pkc456'높이'는'default'에 감사드립니다. – vaibhav
나는 이것을 주석으로 추가하려했으나 너무 깁니다. 그래서 내 [대답] (http://stackoverflow.com/a/39406550/988169)를 확인하십시오. – pkc456