|
@@ -32,7 +32,13 @@
|
|
|
- (void)viewDidLoad {
|
|
- (void)viewDidLoad {
|
|
|
[super viewDidLoad];
|
|
[super viewDidLoad];
|
|
|
// Do any additional setup after loading the view.
|
|
// Do any additional setup after loading the view.
|
|
|
- tableSize = CGSizeMake(180, 200);
|
|
|
|
|
|
|
+// tableSize = CGSizeMake(180, 200);
|
|
|
|
|
+
|
|
|
|
|
+ tableSize = CGSizeZero;
|
|
|
|
|
+ if (self.sortData.count) {
|
|
|
|
|
+ tableSize = CGSizeMake(180, 40 * self.sortData.count);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
self.view.backgroundColor = [UIColor colorWithRed:0.3 green:0.3 blue:0.3 alpha:0.5];
|
|
self.view.backgroundColor = [UIColor colorWithRed:0.3 green:0.3 blue:0.3 alpha:0.5];
|
|
|
|
|
|
|
|
[self.view addSubview:self.tableBackgroundView];
|
|
[self.view addSubview:self.tableBackgroundView];
|
|
@@ -75,7 +81,7 @@
|
|
|
#pragma mark data source
|
|
#pragma mark data source
|
|
|
|
|
|
|
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
|
- return 5;
|
|
|
|
|
|
|
+ return self.sortData.count;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
@@ -85,31 +91,36 @@
|
|
|
}
|
|
}
|
|
|
// cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
// cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
|
|
|
|
|
|
- switch (indexPath.row) {
|
|
|
|
|
- case 0:{
|
|
|
|
|
- cell.sortTitle = @"Last";
|
|
|
|
|
- }
|
|
|
|
|
- break;
|
|
|
|
|
- case 1:{
|
|
|
|
|
- cell.sortTitle = @"First";
|
|
|
|
|
- }
|
|
|
|
|
- break;
|
|
|
|
|
- case 2:{
|
|
|
|
|
- cell.sortTitle = @"Item number a-z";
|
|
|
|
|
- }
|
|
|
|
|
- break;
|
|
|
|
|
- case 3:{
|
|
|
|
|
- cell.sortTitle = @"Item number z-a";
|
|
|
|
|
- }
|
|
|
|
|
- break;
|
|
|
|
|
- case 4:{
|
|
|
|
|
- cell.sortTitle = @"Description";
|
|
|
|
|
- }
|
|
|
|
|
- break;
|
|
|
|
|
-
|
|
|
|
|
- default:
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// switch (indexPath.row) {
|
|
|
|
|
+// case 0:{
|
|
|
|
|
+// cell.sortTitle = @"Last";
|
|
|
|
|
+// }
|
|
|
|
|
+// break;
|
|
|
|
|
+// case 1:{
|
|
|
|
|
+// cell.sortTitle = @"First";
|
|
|
|
|
+// }
|
|
|
|
|
+// break;
|
|
|
|
|
+// case 2:{
|
|
|
|
|
+// cell.sortTitle = @"Item number a-z";
|
|
|
|
|
+// }
|
|
|
|
|
+// break;
|
|
|
|
|
+// case 3:{
|
|
|
|
|
+// cell.sortTitle = @"Item number z-a";
|
|
|
|
|
+// }
|
|
|
|
|
+// break;
|
|
|
|
|
+// case 4:{
|
|
|
|
|
+// cell.sortTitle = @"Description";
|
|
|
|
|
+// }
|
|
|
|
|
+// break;
|
|
|
|
|
+//
|
|
|
|
|
+// default:
|
|
|
|
|
+// break;
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ NSDictionary *sortItem = [self.sortData objectAtIndex:indexPath.row];
|
|
|
|
|
+ cell.sortItem = sortItem;
|
|
|
|
|
+
|
|
|
cell.sortIndex = indexPath.row;
|
|
cell.sortIndex = indexPath.row;
|
|
|
|
|
|
|
|
// if (self.sortIndex == indexPath.row) {
|
|
// if (self.sortIndex == indexPath.row) {
|
|
@@ -140,7 +151,7 @@
|
|
|
// SortItemCell *oldCell = [tableView cellForRowAtIndexPath:oldIndexPath];
|
|
// SortItemCell *oldCell = [tableView cellForRowAtIndexPath:oldIndexPath];
|
|
|
// oldCell.selectedSort = NO;
|
|
// oldCell.selectedSort = NO;
|
|
|
|
|
|
|
|
- self.sortIndex = indexPath.row;
|
|
|
|
|
|
|
+ self.sortIndex = (int)indexPath.row;
|
|
|
cell.selectedSort = YES;
|
|
cell.selectedSort = YES;
|
|
|
|
|
|
|
|
if (self.sortBlock) {
|
|
if (self.sortBlock) {
|