Im working with the code below in developing simple ios app using objective-C.Is that have another way to optimize this code:
if ([segue.identifier isEqualToString:@"showCommitDetail"]) {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
CommitDetailsTableViewController *destViewController = segue.destinationViewController;
RepoObject *repoObj = [self.RepoListArray objectAtIndex:indexPath.row];
NSString *repoCommit_url = [repoObj.Commit_url stringByReplacingOccurrencesOfString:@"{/sha}" withString:@""];
if (indexPath.row == 0) {
NSString *SpringBootURL = repoCommit_url;
self.commit_url = SpringBootURL;
destViewController.CommitRepoURL = self.commit_url;
destViewController.navigationItem.title = @"Spring-Integration-in-Action";
}else if (indexPath.row == 1){
NSString *SpringFrameworkURL = repoCommit_url;
self.commit_url = SpringFrameworkURL;
destViewController.CommitRepoURL = self.commit_url;
destViewController.navigationItem.title = @"spring-data-jdbc-ext";
}else if (indexPath.row == 2){
NSString *SpringAmqpURL = repoCommit_url;
self.commit_url = SpringAmqpURL;
destViewController.CommitRepoURL = self.commit_url;
destViewController.navigationItem.title = @"spring-data-commons";
}else if (indexPath.row == 3){
NSString *SpringIdeURL = repoCommit_url;
self.commit_url = SpringIdeURL;
destViewController.CommitRepoURL = self.commit_url;
destViewController.navigationItem.title = @"spring-data-graph";
}else{
NSString *SpringIntegratURL = repoCommit_url;
self.commit_url = SpringIntegratURL;
destViewController.CommitRepoURL = self.commit_url;
destViewController.navigationItem.title = @"spring-data-document-examples";
}
}
Beside that, how can i assign title directly without hard-coding it like i did above.?
Aucun commentaire:
Enregistrer un commentaire