Question: 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?

Answer: 
Pass a boolean value from notification and check for the same in the onCreate method of the activity.

```
 Intent intent = new Intent(ctx, MainActivity.class);
 intent.putExtra("fromNotification", true);

```

...

```
if (getIntent().getExtras() != null) {
  Bundle b = getIntent().getExtras();
  boolean cameFromNotification = b.getBoolean("fromNotification");
}

```
Better than using the reserved action field of your intent as specified by @ricintech, you could use an extra parameter in your pending intent and detect it in your `onCreate` method and in your `onNewIntent` metod inside your activity.