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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:56:45+00:00 2026-06-16T21:56:45+00:00

I actually wrote a method which switches some UIViews. When I enter the method

  • 0

I actually wrote a method which switches some UIViews. When I enter the method I have to know which is my current view to remove exactly this one from the superview. I declared a property for this purpose in the header file:

@property (weak, nonatomic) UIView *currentView;

After I changed to a certain view in my method, I want to assign this view to the property in order to use it when I enter the method again and remove this view from the superview if requested. The method looks like this:

...
nextView = [self loadNextView]; // the view is loaded from a NIB here
if (self)
{
    [self viewWillDisappear:YES];
    [[self currentView] removeFromSuperview];
    [[self view] addSubview:nextView];
    [self currentView] = [self nextView];
...

Unfortunately the compiler tells me that currentView is not assignable here. Is there another, hopefully better, way to remeber the curernt view for my purpose or should I use a completely different way?

  • 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-16T21:56:47+00:00Added an answer on June 16, 2026 at 9:56 pm

    Instead of the following line,

    [self currentView] = [self nextView];
    

    do as follows:

    [self setCurrentView:[self nextView]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with deleting my objects. I wrote a delete method which
I have trouble with some code I just wrote. Basically, this code is inside
I have a class. In c#, is there some way (which i can implement
I have some difficulties understanding how the access method Do not move cursor automatically
I have this line of code: t.ContinueWith(_ => form.Close(), TaskScheduler.FromCurrentSynchronizationContext()); ...about which the compiler
I have a small utility extension method that performs some null checks on some
I certainly don't know how to title this question, sorry. I'm having some problems
I'm trying to write a wrapper around Image_Graph bar charts. I actually wrote the
I hope the title actually describes what I wanted to ask... I wrote a
So I know of a few people that actually write their algorithms out in

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.