beer2011
Oct 19, 2014 - 21:18
Hello, all.
This code do not work.
When you tap , it will not work. (~~;;)
Any suggestion,please...
# coding: utf-8
import ui
import console
class MyTableView(object):
def __init__(self):
foods = [{'title': 'Vegitable'},
{'title': 'Fruits'},
{'title': 'Fish'}]
self.list = ui.ListDataSource(foods)
self.tv = ui.TableView()
self.tv.name = 'Kind'
self.tv.delegate = self.tv.data_source = self.list
nv = ui.NavigationView(self.tv)
nv.name = 'Foods'
nv.present('sheet')
def tableview_did_select(self, tableview, section, row):
self.tv.name = self.list[row]['title']
self.tv.delegate = self.tv.data_source = self.list
table_view.navigation_view.push_view(self.tv)
def tableview_number_of_sections(self, tableview):
return 1
def tableview_number_of_rows(self, tableview, section):
return len(self.list)
def tableview_cell_for_row(self, tableview, section, row):
cell = ui.TableViewCell()
cell.text_label.text = self.list
return cell
### main ########################
MyTableView()