i am using table view to navigate the files on FTP.when user enters url i am appending the path for the clicked row in url field.It works fine for first click but as user clicks again double backslash gets added.I want to add backslash only for first click.Is it Possible to added check for another click?Hope i am clear with question.please help.`
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSDictionary * listEntry;
listEntry = [self.listEntries objectAtIndex:((NSUInteger) indexPath.row) - 1];
NSString *dict=[listEntry objectForKey:(id) kCFFTPResourceName];
NSLog(@"dict%@",dict);
NSString *fvalue = [NSString stringWithFormat:@"/%@/",dict];
NSLog(@"%@",fvalue);
NSString *appendURl=[NSString stringWithFormat:@"%@%@",self.urlText.text,fvalue];
self.urlText.text=appendURl;
}
Handled it by if else condition and using hasSuffix,problem got solved.`
if ([self.urlText.text hasSuffix:@"/"])
{
appendURl=[NSString stringWithFormat:@"%@%@",self.urlText.text,fvalue];
}
else
{
appendURl=[NSString stringWithFormat:@"%@/%@",self.urlText.text,fvalue];
}