Dodawanie małej strzałki po prawej stronie komórki w komórce TableView iPhone ' a
To powinno być dość proste.
Mam aplikację na iPhone ' a z TableView. Jak dodać małą klasyczną strzałkę po prawej stronie każdej komórki?
8 answers
Wystarczy ustawić odpowiednie accessoryType własność UITableViewCell .
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
In Swift 3,
cell.accessoryType = .disclosureIndicator
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-04-17 14:20:54
Możesz to zrobić w Interface Builder. Po prostu kliknij kliknij na widok tabeli , Przejdź do Prototype Cells po prawej stronie i ustaw go na 1. Następnie kliknij prototyp Komórki i po prawej stronie poszukaj akcesorium . Z listy rozwijanej kliknij wskaźnik ujawnienia .
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-08-20 16:03:54
Możesz ustawić małą klasyczną strzałkę w dwie strony, jak poniżej
1) Używanie wbudowanej metody typu akcesoriów UITableViewCell
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
2) Tworzenie własnego widoku akcesoriów z własnym obrazem
(i) przeciągnij i upuść obraz strzałki (np. circle_arrow_right.png) w Twoim projekcie
(II) w metodzie projektowania komórek dla każdego wiersza jak poniżej
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
Wpisz poniższy kod:
if (cell ==nil) {
cell=[[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]autorelease];
//For creating custom accessory view with own image
UIImageView *accessoryView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
[accessoryView setImage:[UIImage imageNamed:@"circle_arrow_right.png"]];
[cell setAccessoryView:accessoryView];
[accessoryView release];
//Your other components on cells
.............
.............
}
[Uwaga: wybierz odpowiednie obrazy do widoku akcesoriów i dodaj pożądane komórki. Wybierz małe obrazy dla widoków akcesoriów, aby uzyskać lepszą wydajność.]
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-03-04 10:38:19
Użyj właściwości accessoryType
komórki, aby wyświetlić strzałkę po prawej stronie. Zobacz to .
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2011-06-12 15:58:18
Dla prostej strzałki:
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
I dla szczegółowej strzałki:
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2012-10-23 08:32:22
Innym sposobem jest określenie UITableViewCellAccessoryDisclosureIndicator
Podczas tworzenia komórki. Aby to zrobić, prawdopodobnie alloc uruchomi swoją komórkę w metodzie delegata tableViewCellWithReuseIdentifier (następnie przejdź do dostosowania i konfiguracji komórki).
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellAccessoryDisclosureIndicator reuseIdentifier:identifier];
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2012-11-06 01:59:45
Swift 3:
cell.accessoryType = .disclosureIndicator
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-11-07 02:21:54
Najlepiej wybrać Disclosure Indicator
w sekcji Accessory
.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-02-14 09:36:11