Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9132539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:19:40+00:00 2026-06-17T08:19:40+00:00

I need to check if some object has text property. For example it can

  • 0

I need to check if some object has text property. For example it can be an UIButton or an UILabel. But there is an issue between properties that display text for an UIButton and for an UILabel.

This is the difference:

For an UIButton we set text using setTitle: method, but for an UILabel we using another one named setText:

What I need to do with this:

I need to get all subviews and if these subviews have text property I need to change this property value with some text.

So of course I can check class of object and setup needed property, but maybe we have another approach to do it without checking class of object.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:19:41+00:00Added an answer on June 17, 2026 at 8:19 am
    for (id item in [self.view subviews])
    {
        if ([item respondsToSelector:@selector(text)])
            [item setText:@"text"]; // change text for UILabel
        else if ( [item respondsToSelector:@selector(setTitle:forState:)])
            [item setTitle:@"text" forState:UIControlStateNormal]; // change text for UIButton
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to check in some fast way if there is any text nodes
I've a some type (object of Type ). Need to check that this type
I want to check if an object has some count or not Here is
I need to check some settings for all users on Windows clients in the
I need to check if some pictures (eps, tiff files) are in 300 DPI
For some reason I need to check in a couple of files in the
In some of my tests i need to check the order of Lists and
I need to check whether a string contains any swear words. Following some advice
In a TextBox I'm monitoring the text changes. I need to check the text
I'm getting NullPointerException because I try to check some value from an object that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.