Customized UITextField as an Combo-box using STControls

I am going to illustrate STControls using this post. Well, STControls is basically nothing but customized UITextField controls.

STControls is basically having two custom controls.

  • STComboText – This customized control enables facility for using UITextField as an ComboBox.
  • STDateText  – This customized control enables facility for using UITextField as an DatePickerBox.

Anyone can download the source code from here. It includes both necessary files & sample project.

Here are the screen-shots of Output.

STControls Output 1

STControls Output 1

STControls Output 2

STControls Output 2

STControls Output 3

STControls Output 3

1) Download the Sample Code.

2) Unzip the downloaded file.

3) Open STControls/STControls Folder.

3) Explore for Following files, Select those files, drag & drop it into your project. ( As illustrated follows )

STControls Files

4) It should appear as illustrated below.

STControls Files in Project

5) Now open your viewController.xib ( interface file )

This is sample User Interface for this post.

STControls Sample 1

6) Now Select the textField ( in this case txtCategory – textField ) & open class inspector & modify the name as illustrated below.

STControls Sample 2

7) Connect delegate & delegateVCtr to File’s owner as illustrated below.

STControls Sample 3

8) Now, Open your viewController’s.h file ( header file ) I have listed sample code here for this post.

9) Now edit your ViewControll’s.m file ( implementation file ) & implement the textFieldDelegate method as illustrated follows.

10) Grab this sample code from here.

15 thoughts on “Customized UITextField as an Combo-box using STControls

  1. Hello there,

    I recently using STControl on my project, but I have one problem.

    The STControl I capsulate with UITableViewCell. I create STComboBox inside the cell, but I cannot delegate the STControl to Table Cell. It just want delegate to File’s Owner, but if I delegate to File’s Owner it’s always show error message “Uncategorized”.

    Can you help me to solve this problem or have you sample script for my condition above.

  2. Hello there,

    I already testing STControl and it’s wonderfull success.

    But i have one problem with STControl. I used STComboBox inside UITableView, and the UITextField cannot to delegateVCtr into Table Cell. It’s just want to delegateVCtr into File’s Owner. I already try to move the @property into File’s Owner but it will show another error message “Uncategorized”.

    Can you help me with the problem?are you have sample script for my problem?are you have sample script to create Combo Box without STControl?

  3. Hello,

    i would like to use this in my project, but the code is copyrighted.
    So my question is : is this code usable for free or just throwable ?

    Thank you for the answer :)

  4. Hello, I’m trying to use STDateText and I changed the textFieldShouldBeginEditing to:

    – (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
    if([textField isKindOfClass:[STDateText class]]) {
    [(STDateText*)textField showDatePicker];
    return NO;
    }
    return YES;
    }

    And it open the date picker… but when i click in Done, the app crash:

    ViewController stDateText:dateChangedTo:]: unrecognized selector sent to instance 0x68430e0

    What i’m doing wrong? and how I set the STDatePickerModeDate parammeter?

    Thanks a lot! Congrats!

    • Hi Bro !

      You just need to add the method. We forgot to add the method.
      We have set the selector when user taps on done button. But that selector method is not written in the sample code.
      If you add that method, everything will work fine.

  5. Nice tutorial.
    Im using this in my project and i m having 4 errors ..
    property selectedkey not found on object of found ViewController .. please help ..
    Thanks alot ..

  6. Hi there
    Great tutorial!
    I ‘m new to ios and i m interested hoe to use date with text field, and how to when i am having two text fields how to make date picker for each of them?

Leave a Reply

Your email address will not be published. Required fields are marked *


*