slider bar and label

Discussion in 'iOS Programming' started by Kapthehat, Jul 22, 2013.

  1. Kapthehat macrumors member

    Joined:
    Jul 1, 2013
    #1
    Hi

    I am working through Apress Beginning IOS 6 development. I am on chapter 4 and have a couple of errors. Firstly I cant seem to connect the "label" to the .m file. Ctrl dragging has no affect - although a blue line appears, nothing appears in the .m file (i.e no pop up appears).

    Also I get an error stating property 'sliderlabel' not found on the object of type BIDController ? (see screenshot). Thanks

    here's the .h file :-

    Code:
    
    //
    //  BIDViewController.h
    //  Control Fun
    //
    //  Created by Kapil Kapur on 19/07/2013.
    //  Copyright (c) 2013 Apress. All rights reserved.
    //
    
    #import <UIKit/UIKit.h>
    
    @interface BIDViewController : UIViewController
    @property (strong, nonatomic) IBOutlet UIView *nameField;
    
    @property (weak, nonatomic) IBOutlet UITextField *numberField;
    
    -(IBAction)textFieldDoneEditing:(id)sender;
    -(IBAction)backgroundTap:(id)sender;
    
    @end
    
    

    and the .m file is below:-

    Code:
    
    /
    //  BIDViewController.m
    //  Control Fun
    //
    //  Created by Kapil Kapur on 19/07/2013.
    //  Copyright (c) 2013 Apress. All rights reserved.
    //
    
    #import "BIDViewController.h"
    
    @interface BIDViewController ()
    
    @end
    
    @implementation BIDViewController
    
    - (void)viewDidLoad
    {
        [super viewDidLoad];
    	// Do any additional setup after loading the view, typically from a nib.
    }
    
    - (void)didReceiveMemoryWarning
    {
        [super didReceiveMemoryWarning];
        // Dispose of any resources that can be recreated.
    }
    
    -(IBAction)textFieldDoneEditing:(id)sender
    {
        [sender resignFirstResponder];
    }
    
    -(IBAction)backgroundTap:(id)sender{
        [self.nameField resignFirstResponder];
        [self.numberField resignFirstResponder];
        
    }
    - (IBAction)sliderChanged:(UISlider *)sender {
        int progress =lroundf(sender.value);
        self.sliderLabel.text= [NSString stringWithFormat:@"%d",progress];
    }
    
    @end
    
    
     

    Attached Files:

  2. Tander macrumors 6502a

    Tander

    Joined:
    Oct 21, 2011
    Location:
    Johannesburg, South Africa
    #2
    Where did you declare the slider label property?
     
  3. waterskier2007 macrumors 68000

    waterskier2007

    Joined:
    Jun 19, 2007
    Location:
    White Lake, MI
    #3
    I may be reading wrong, but I believe you want to drag the slider label to the .h file rather than the .m file

    If you are dragging it to the .m file you may want to drag it to the @interface area of the .m file
     
  4. Kapthehat thread starter macrumors member

    Joined:
    Jul 1, 2013
    #4
    thanks - slightly confused by your question. How am I mean to declare it ? I did use the .m file,

    regards

    Kaps
     
  5. Kapthehat thread starter macrumors member

    Joined:
    Jul 1, 2013
    #5
    got it resolved - for some reason the slider bar had not connected properly to the view (thought it was). all ok now. thanks for your help.
     
  6. Tander macrumors 6502a

    Tander

    Joined:
    Oct 21, 2011
    Location:
    Johannesburg, South Africa
  7. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #7

Share This Page