UITableView의 테두리를 설정하는 방법은 무엇입니까? (How to set a border for UITableView?)


문제 설명

UITableView의 테두리를 설정하는 방법은 무엇입니까? (How to set a border for UITableView?)

하나의 UITableView와 하나의 UIScrollView로 구성된 보기를 만들었습니다. 이제 UITableView에 대한 테두리를 그려야 UIScrollView에서 분리할 수 있습니다.


참조 솔루션

방법 1:

Check out UIView layer property which allows you to define visible border for the view. Try out the following:

#import <QuartzCore/QuartzCore.h>

...

self.yourtableview.layer.borderWidth = 2;
self.yourtableview.layer.borderColor = [[UIColor whiteColor] CGColor];

Also remember to include QuartzCore.framework in your project Frameworks list.

방법 2:

There is another way to set the table boarder.

1.You just add the UIView whose size is little larger than table view. Add the table view as a subview of the view.

As, if table view frame size is (2,2,100, 200), then the view size should be (0,0,104,204).

2.Set the backgroundColor of the view as you want to set for the border color.

(by raghuAri J.R.iPhoneDv)

참조 문서

  1. How to set a border for UITableView? (CC BY‑SA 3.0/4.0)

#uitableview #objective-c #iOS






관련 질문

레코드 삭제 중 오류 발생, 포착되지 않은 예외 'NSInternalInconsistencyException'으로 인해 앱 종료 (error while deleting records,Terminating app due to uncaught exception 'NSInternalInconsistencyException')

IOS 7에서 편집 상태의 셀을 반환하는 dequeueReusableCellWithIdentifier (dequeueReusableCellWithIdentifier returning cells in editing state in IOS 7)

UITableViewCell 탭 호버 (UITableViewCell tap hover)

ios swift tableview 셀 사이의 공간을 어떻게 변경할 수 있습니까? (How can I change the space between tableview cells ios swift)

테이블 뷰 셀을 선택할 때 뷰 컨트롤러를 푸시할 수 없습니다. (Can't push my view controller when I select a table view cell)

셀이 선택되면 UIImageView가 사라지지만 UILabel은 사라지지 않습니다. (UIImageView disappears but not UILabel when cell is selcted)

UITableView의 테두리를 설정하는 방법은 무엇입니까? (How to set a border for UITableView?)

plist에서 특정 데이터를 가져오는 UITableView(탐색 템플릿을 사용하지 않음) (UITableView (not using Navigation Template) getting specific data from plist)

searchBar의 일반 텍스트 버튼에 액세스하는 방법은 무엇입니까? (How to access searchBar's clear text button?)

'NSInternalInconsistencyException', 이유: '범위를 벗어난 섹션(0)에 대한 행 수를 요청했습니다.' ('NSInternalInconsistencyException', reason: 'Requested the number of rows for section (0) which is out of bounds.')

UITableViewCell에서 키보드 탭을 숨기는 UITapGestureRecognizer (UITapGestureRecognizer to hide keyboard taps on UITableViewCell)

특정 UITableViewCells에 고유한 삽입을 추가하는 방법은 무엇입니까? (How to add unique insets to specific UITableViewCells?)







코멘트