|
|
|
iOS - UISearchBar Not shifting up is it's possible |
|
|
|
|
|
|
|
Hi,sathish
remove UISearchDisplayController in .xib file
Thanks
|
|
|
|
|
Date :
2013-08-14 13:59:55 |
By :
j4kkapongz |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
I remove UISearchDisplayController in .xib file
search is not working
|
|
|
|
|
Date :
2013-08-14 14:39:10 |
By :
vishwa |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Thanks
|
|
|
|
|
Date :
2013-08-14 16:24:36 |
By :
vishwa |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
I use this method. after search not reload tableview
Code (Objective-C)
-(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
if([searchText length] == 0)
{
[displayObject removeAllObjects];
[displayObject addObjectsFromArray:myObject];
}
else
{
[displayObject removeAllObjects];
for(NSDictionary *tmpDict in myObject)
{
// NSString *val = [tmpDict objectForKey:jobid];
NSMutableString *val;
val = [NSString stringWithFormat:@"%@ %@ %@ %@ %@"
,[tmpDict objectForKey:jobid]
,[tmpDict objectForKey:position]
,[tmpDict objectForKey:rate]
,[tmpDict objectForKey:city]
,[tmpDict objectForKey:state]
];
NSRange r = [val rangeOfString:searchText options:NSCaseInsensitiveSearch];
if(r.location != NSNotFound)
{
[displayObject addObject:tmpDict];
}
}
}
[tableView1 reloadData];
}
-(void) searchBarSearchButtonClicked:(UISearchBar *)searchBar{
[searchBar setShowsCancelButton:NO animated:YES];
[searchBar resignFirstResponder];
tableView1.allowsSelection = YES;
tableView1.scrollEnabled = YES;
}
- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar {
[searchBar setShowsCancelButton:YES animated:YES];
// tableViewObj.allowsSelection = NO;
tableView1.scrollEnabled = NO;
}
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
searchBar.text=@"";
[searchBar setShowsCancelButton:NO animated:YES];
[searchBar resignFirstResponder];
tableView1.allowsSelection = YES;
tableView1.scrollEnabled = YES;
[tableView1 reloadData];
}
|
|
|
|
|
Date :
2013-08-15 12:14:43 |
By :
vishwa |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Hi,sathish
i want to see more code at UITableViewDatasource and UITableViewDelegate
-numberOfSection
-numberOfRowsInSection
-CellForRowAtIndexPath
|
|
|
|
|
Date :
2013-08-15 16:26:18 |
By :
j4kkapongz |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OK
.h file
Code (Objective-C)
@interface Viewcontroller : UIViewController <UITableViewDataSource, UIAccelerometerDelegate, UISearchBarDelegate>
{
IBOutlet UITableView *tableView1;
}
@property(nonatomic, strong) IBOutlet UITableView *tableView1;
@end
.m file
Code (Objective-C)
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return displayObject.count;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle : UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
cell.opaque = NO;
cell.textLabel.backgroundColor = [UIColor clearColor];
cell.detailTextLabel.backgroundColor = [UIColor clearColor];
}
NSDictionary *tmpDict = [displayObject objectAtIndex:indexPath.row];
// JobID & Position
NSMutableString *text;
text = [NSString stringWithFormat:@"%@ %@"
,[tmpDict objectForKey:jobid]
,[tmpDict objectForKey:position]];
// City,State & Rate
NSMutableString *detail;
detail = [NSString stringWithFormat:@" %@ ,%@ ,%@"
,[tmpDict objectForKey:city]
,[tmpDict objectForKey:state]
,[tmpDict objectForKey:rate]];
cell.textLabel.text = text;
cell.detailTextLabel.text= detail;
[cell.textLabel setFont:[UIFont fontWithName:@"Avenir Bold" size:14]];
cell.detailTextLabel.textColor = [UIColor darkGrayColor];
[cell.detailTextLabel setFont:[UIFont fontWithName:@"Avenir" size:15]];
return cell;
}
|
ประวัติการแก้ไข 2013-08-16 10:52:07
|
|
|
|
Date :
2013-08-16 10:50:43 |
By :
vishwa |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2013-08-16 12:27:41 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Hi,sathish
Before reload table nslog to diplay values, it have?
Add break point in cell for row when you reload you get it and check value?
|
|
|
|
|
Date :
2013-08-18 20:37:36 |
By :
j4kkapongz |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
คุณปลา สุดยอดจริงๆ ฝากเป็นลูกศิษย์ด้วยคนครับ
|
|
|
|
|
Date :
2013-08-20 10:20:43 |
By :
phpbasic |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ว่าง ๆ อยากมาชวนแลกเปลี่ยนกันบ้างครับ
|
|
|
|
|
Date :
2013-08-20 10:46:52 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|