나는 UITableView를 가지고있다. 어떻게 간단하게 "e1", "e2", "e3"와 같은 세 가지 요소로 채우십시오? 클래스에 테이블의iPhone 용 TableView를 간단히 채우는 방법
3
A
답변
7
설정 데이터 소스 및 클래스 3 방법에서 정의
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section {
return 3;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellId = @"identifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: cellId];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:cellId] autorelease];
}
[cell setText:[NSString stringWithFormat:@"e%i",indexPath:[indexPath row]];
return cell;
}
0
jQuery과 공부를 보상 구성 요소입니다. UITableView 및 해당 데이터 소스 및 위임 프로토콜에 대한 로컬 문서 페이지를 읽습니다. 문서에도 테이블 뷰 프로그래밍 가이드가 있습니다. 그것은 좋은 읽을 거리입니다. 그 중 일부는 나에게 잠시 걸렸고, 구현할 때마다 여전히 접근 방식을 수정하고 있습니다. API를 사용하고 필요한 방법을 구현하면 자신의 의지대로 구부릴 수 있어야합니다.
Hellra1ser의 예는 올바른 방향으로 사용자를 밀어 넣습니다. 먼저 해당 방법을 찾아보십시오. 많이 사용하게 될 것입니다. 빠른 3.1
0
코드 :
그냥 사람이 테스트의 목적을 위해 붙여 복사 할 필요가있는 경우 경우이다.
extension ViewController : UITableViewDataSource, UITableViewDelegate {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 50
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
cell.textLabel?.text = "Test"
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 60
}
}
관련 문제
- 1. iPhone : tableView를 다시로드하고 AppDelegate에서 detailView를 푸시하는 방법?
- 2. tableView를 사용하는 방법 : editingStyleForRowAtIndexPath?
- 3. android에서 tableview를 스크롤하는 방법
- 4. MySQL 및 Oracle 용 데이터를 채우는 방법?
- 5. iPhone SDK에서 tableview를 가로로 스크롤하는 방법은 무엇입니까?
- 6. 메모리에 빠르게 채우는 iPhone 앱을 만드는 방법
- 7. iPhone/iPad 용 AdMob
- 8. 데이터가있는 TableView를 다시로드하십시오.
- 9. 문자열 변수를 간단히 인코딩하고 디코딩하는 방법
- 10. iphone 용 MPMoviePlayer에서 인증하는 방법
- 11. reloadData에서 tableView를 지우지 않았습니까?
- 12. iPhone SDK 용 파일 버그
- 13. 드롭 다운 메뉴를 채우는 방법
- 14. Perl로 번역하기 (간단히)
- 15. Qt - 간단히 QApplication이란 무엇입니까?
- 16. 프로그래밍 방식으로 scrollview에 tableview를 추가하는 방법
- 17. 현재 viewcontroller에서 다른 uiviewcontroller의 tableview를 다시로드하는 방법
- 18. iPad 용 YouTube App에서와 같이 tableview를 얻는 방법은 무엇입니까?
- 19. 보기를 일시적으로 확장하여 iPhone 화면을 채우는 가장 좋은 방법
- 20. AppDelegate에서 tableView를 다시로드하십시오.
- 21. AutoCompleteCustomSource를 채우는 방법
- 22. 런타임에 온톨로지를 채우는 방법?
- 23. SYSTEMTIME 값을 채우는 방법?
- 24. 열의 숫자를 채우는 방법?
- 25. 세션에서 데이터베이스를 채우는 방법?
- 26. 이 JRDataSource를 채우는 방법?
- 27. XML에서 gridview를 채우는 방법
- 28. 데이터베이스에서 selectManyListbox를 채우는 방법
- 29. wxListCtrl을 채우는 방법?
- 30. django에서 sqlite3을 채우는 방법?