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 7616451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:53:28+00:00 2026-05-31T02:53:28+00:00

What i am trying to do is i read some content from a web

  • 0

What i am trying to do is i read some content from a web service, each content has content type (text,image,button…).
I have to display dynamically the content in the UIView. So what i am trying to do is to create an IBoutlet UIView and check if the content type is a text i convert this uiview to UILable and display the text, if the content type is an image i convert the UIView to a UIImageView etc…
I need to work on the same UIView from the xib file, so how can i change the properties of the UIView to a UILable or a UIImageView.

Thank you

  • 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-05-31T02:53:29+00:00Added an answer on May 31, 2026 at 2:53 am

    You cannot “change” an UIView to be something different.

    I suggest you dynamically add subviews to your view:

    UIView *newView = nil;
    switch (content type) {
        case 0: // text
            newView = [[UILabel alloc] init];
            ((UILabel*)newView).text = @"someText";
            [newView sizeToFit];
        case 1: // button
        {
            UIButton *btn = [UIButton buttonWithType:...];
            [btn setTititle:@"Ttile" forControlState:UIControlStateNormal]; // assign all needed properties
            ...
            newView = btn;
        }
        case 2:
        ....
    }
    newView.frame = ... // calculate Frame using previously created content (e.g. remember y offset and add bounds.size.height after every iteration)
    [self.view addSubView:newView];
    ....
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to read some info from a text file by using windows
I'm trying to create a list of tasks that I've read from some text
I'm trying to read some text from an html file, modify it in a
I am trying to read some settings from php.ini using zend. The API that
I'm trying to read in some sample data from an XML file in a
I am trying to get some data from a web server. When I go
I have a small issue. I am trying to pull some data from my
I'm trying to read a remote binary file (say, image) from internet like this:
I'm trying to read some OpenGL tutorials on the net. the problem is that
I am trying to read some smps files with python, and found a fortran

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.