Search Results

Search found 4 results on 1 pages for 'vikingosegundo'.

Page 1/1 | 1 

  • tableView:didSelectRowAtIndexPath: calls TTNavigator openURLAction:applyAnimated: — UITabBar and na

    - by vikingosegundo
    I have an existing iphone project with a UITabBar. Now I need styled text and in-text links to other ViewControllers in my app. I am trying to integrate TTStyledTextLabel. I have a FirstViewController:UITabelViewController with this tableView:didSelectRowAtIndexPath: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSString *url; if ([self.filteredQuestions count]>0) { url = [NSString stringWithFormat:@"%@%d", @"tt://question/", [[self.filteredQuestions objectAtIndex:indexPath.row] id]]; [[TTNavigator navigator] openURLAction:[[TTURLAction actionWithURLPath: url] applyAnimated:YES]]; } else { Question * q = [self.questions objectAtIndex:indexPath.row] ; url = [NSString stringWithFormat:@"%@%d", @"tt://question/", [q.id intValue]]; } TTDPRINT(@"%@", url); TTNavigator *navigator = [TTNavigator navigator]; [navigator openURLAction:[[TTURLAction actionWithURLPath: url] applyAnimated:YES]]; } My mapping looks like this: TTNavigator* navigator = [TTNavigator navigator]; navigator.window = window; navigator.supportsShakeToReload = YES; TTURLMap* map = navigator.URLMap; [map from:@"*" toViewController:[TTWebController class]]; [map from:@"tt://question/(initWithQID:)" toViewController:[QuestionDetailViewController class]]; and my QuestionDetailViewController: @interface QuestionDetailViewController : UIViewController <UIScrollViewDelegate , QuestionDetailViewProtocol> { Question *question; } @property(nonatomic,retain) Question *question; -(id) initWithQID:(NSString *)qid; -(void) goBack:(id)sender; @end When I hit a cell, q QuestionDetailViewController will be called — but the navigationBar wont @implementation QuestionDetailViewController @synthesize question; -(id) initWithQID:(NSString *)qid { if (self = [super initWithNibName:@"QuestionDetailViewController" bundle:nil]) { //; TTDPRINT(@"%@", qid); NSManagedObjectContext *managedObjectContext = [(domainAppDelegate*)[[UIApplication sharedApplication] delegate] managedObjectContext]; NSPredicate *predicate =[NSPredicate predicateWithFormat:@"id == %@", qid]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Question" inManagedObjectContext:managedObjectContext]; NSFetchRequest *request = [[NSFetchRequest alloc] init]; [request setEntity:entity]; [request setPredicate:predicate]; NSError *error = nil; NSArray *array = [managedObjectContext executeFetchRequest:request error:&error]; if (error==nil && [array count]>0 ) { self.question = [array objectAtIndex:0]; } else { TTDPRINT(@"error: %@", array); } } return self; } - (void)viewDidLoad { [super viewDidLoad]; [TTStyleSheet setGlobalStyleSheet:[[[TextTestStyleSheet alloc] init] autorelease]]; [self.navigationController.navigationBar setTranslucent:YES]; NSArray *includedLinks = [self.question.answer.text vs_extractExternalLinks]; NSMutableDictionary *linksToTT = [[NSMutableDictionary alloc] init]; for (NSArray *a in includedLinks) { NSString *s = [a objectAtIndex:3]; if ([s hasPrefix:@"/answer/"] || [s hasPrefix:@"http://domain.com/answer/"] || [s hasPrefix:@"http://www.domain.com/answer/"]) { NSString *ttAdress = @"tt://question/"; NSArray *adressComps = [s pathComponents]; for (NSString *s in adressComps) { if ([s isEqualToString:@"qid"]) { ttAdress = [ttAdress stringByAppendingString:[adressComps objectAtIndex:[adressComps indexOfObject:s]+1]]; } } [linksToTT setObject:ttAdress forKey:s]; } } for (NSString *k in [linksToTT allKeys]) { self.question.answer.text = [self.question.answer.text stringByReplacingOccurrencesOfString:k withString: [linksToTT objectForKey:k]]; } TTStyledTextLabel *answerText = [[[TTStyledTextLabel alloc] initWithFrame:CGRectMake(0, 0, 320, 700)] autorelease]; if (![[self.question.answer.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] hasPrefix:@"<div"]) { self.question.answer.text = [NSString stringWithFormat:@"%<div>%@</div>", self.question.answer.text]; } NSString * s = [NSString stringWithFormat:@"<div class=\"header\">%@</div>\n%@",self.question.title ,self.question.answer.text]; answerText.text = [TTStyledText textFromXHTML:s lineBreaks:YES URLs:YES]; answerText.contentInset = UIEdgeInsetsMake(20, 15, 20, 15); [answerText sizeToFit]; [self.navigationController setNavigationBarHidden:NO animated:YES]; [self.view addSubview:answerText]; [(UIScrollView *)self.view setContentSize:answerText.frame.size]; self.view.backgroundColor = [UIColor whiteColor]; [linksToTT release]; } ....... @end This works quite nice, as soon as a cell is touched, a QuestionDetailViewController is called and pushed — but the tabBar will disappear, and the navigationItem — I set it like this: self.navigationItem.title =@"back to first screen"; — won't be shown. And it just appears without animation. But if I press a link inside the TTStyledTextLabel the animation works, the navigationItem will be shown. How can I make the animation, the navigationItem and the tabBar be shown?

    Read the article

  • TTLauncherItem: change badge immediately (or: how to refresh TTLauncherView)

    - by vikingosegundo
    I have a TTLauncherView with some TTLauncherItems. These show badges, representing messages from the network. I set the badges in viewWillAppear:, so if I switch to another view and then return, the correct badges are shown. But I want to update the badges as soon a message comes in. Calling setNeedsDisplay on TTLauncherView doesn't help? How can I refresh the TTLauncherView? in my MessageReceiver class I do this: TTNavigator* navigator = [TTNavigator navigator]; [(OverviewController *)[navigator viewControllerForURL:@"tt://launcher"] reloadLauncherView] ; My TTViewController-derived OverviewController @implementation OverviewController - (id)init { if (self = [super init]) { self.title = OverviewTitle; } return self; } - (void)dealloc { [items release]; [overView release]; [super dealloc]; } -(void)viewDidLoad { [super viewDidLoad]; overView = [[TTLauncherView alloc] initWithFrame:self.view.bounds]; overView.backgroundColor = [UIColor whiteColor]; overView.delegate = self; overView.columnCount = 4; items = [[NSMutableArray alloc] init]; for(int i = 1; i <= NumberOfBars; ++i){ NSString *barID = [NSString stringWithFormat:NameFormat, IDPrefix, i]; TTLauncherItem *item = [[[TTLauncherItem alloc] initWithTitle:barID image:LogoPath URL:[NSString stringWithFormat:@"tt://item/%d", i] canDelete:NO] autorelease]; [barItems addObject: item]; } overView.pages = [NSArray arrayWithObject:items]; [self.view addSubview:overView]; } -(void)viewWillAppear:(BOOL)animated { for(int i = 0; i <[barItems count]; i++){ TTLauncherItem *item = [items objectAtIndex:i]; NSString *barID = [NSString stringWithFormat:NameFormat, IDPrefix, i+1]; P1LOrderDispatcher *dispatcher = [OrderDispatcher sharedInstance]; P1LBarInbox *barInbox = [dispatcher.barInboxMap objectForKey:barID]; item.badgeNumber = [[barInbox ordersWithState:OrderState_New]count]; } [super viewWillAppear:animated]; } - (void)launcherView:(TTLauncherView*)launcher didSelectItem:(TTLauncherItem*)item { TTDPRINT(@"%@", item); TTNavigator *navigator = [TTNavigator navigator]; [navigator openURLAction:[TTURLAction actionWithURLPath:item.URL]]; } -(void)reloadLauncherView { [overView setNeedsDisplay];//This doesn't work } @end

    Read the article

  • How to retrieve Directories size including all sub-directories?

    - by vikingosegundo
    I have stored images from the net like this Documents/imagecache/domain1/original/path/inURI/foo.png Documents/imagecache/domain2/original/path/inURI/bar.png Documents/imagecache/... Documents/imagecache/... Now I'd like to check the size of imagecache including all it sub-directories. Is there a convenient way of doing it — preferable without crawling through all the data manually?

    Read the article

  • Extend PickerViews Component while touching

    - by vikingosegundo
    I have a UIPickerView with a variable number of components to display. In its contoller i have this -pickerView:withForComponent: - (CGFloat)pickerView:(UIPickerView *)pv widthForComponent:(NSInteger)component { CGFloat f; if (component == 0) { f = 30; } else { if ([componentsData count]>2) { f = 260.0/([componentsData count]-1); } else{ f = 260.0; } } return f; } this works fine if I call [pickerView reloadAllComponents], but how could I extend a components width if it is touched (and of course shrink all others)?

    Read the article

1