如何根据NextviewControllerValue设置徽章值?

时间:2016-02-12 11:51:43

标签: ios objective-c badge message-passing

我想在firstComponentValue徽章中填充lbl_card_count

        UILabel *lbl_card_count = [[UILabel alloc]initWithFrame:CGRectMake(23,0, 13, 13)];
        int Temp_card_count;
        lbl_card_count.textColor = [UIColor whiteColor];
        lbl_card_count.textAlignment = NSTextAlignmentCenter;
        lbl_card_count.text = [NSString stringWithFormat:@"%d",Temp_card_count];
        lbl_card_count.layer.borderWidth = 1;
        lbl_card_count.layer.cornerRadius = 8;
        lbl_card_count.layer.masksToBounds = YES;
        lbl_card_count.layer.borderColor =[[UIColor clearColor] CGColor];
        lbl_card_count.layer.shadowColor = [[UIColor clearColor] CGColor];
        lbl_card_count.layer.shadowOffset = CGSizeMake(0.0, 0.0);
        lbl_card_count.layer.shadowOpacity = 0.0;
        lbl_card_count.backgroundColor = [UIColor colorWithRed:247.0/255.0 green:45.0/255.0 blue:143.0/255.0 alpha:1.0];
        lbl_card_count.font = [UIFont fontWithName:@"ArialMT" size:11];
        [lbl_card_count setHidden:YES];
        [appliancesButton addSubview:lbl_card_count];
        [categoryView addSubview:appliancesButton];


-(void)changecolor:(UIGestureRecognizer *)gestureRecognizer
{
    AddApplianceViewController *addApplianceVC = [[AddApplianceViewController alloc]init];
    [self showPopupWithTransitionStyle:STPopupTransitionStyleSlideVertical rootViewController:addApplianceVC];
    addApplianceVC.labelText = gestureRecognizer.accessibilityLabel;
    NSLog(@"tapped");
}

AddAppliancesViewController.m

-(void)setButtonAction
{
if ([self.picker selectedRowInComponent:0]!=0)
{

    firstComponentValue = [self.picker selectedRowInComponent:0];
    NSLog(@"Appliances Count==>>%d",firstComponentValue);

    [self dismissViewControllerAnimated:YES completion:NO];
}
else
{
    [self alert];
}

}`

0 个答案:

没有答案