Reputation: 93
I have a button hooked up in the storyboard to a method onButtonPress
. In that method I call [pressedButton removeFromSuperview]
but the view is not removed. I have even tried [_scrollView setNeedsDisplay];
and [_scrollView setNeedsLayout];
with no luck. I am assuming this is a restriction on being able to remove the button I have pressed. Is there a way I can signal to the view controller to call a method in the future to remove this button?
Upvotes: 0
Views: 75
Reputation: 93
Nevermind, actually. I was making a silly mistake.
The view I was pressing is part of a custom table I implemented to avoid the tableview in the scrollview. What I was doing was removing all the table cells from the table then re-adding them with the exception of the one that was clicked. Except right before I looped through the array which held the views and called [view removeFromSuperview]
, I removed the view I pressed from that array. Therefore, it was never calling that method.
So I was doing
[_taskViewCells removeObject:t];
for (id taskViewCell in _taskViewsCells) {
[taskViewCell removeFromSuperview];
// Remove all the task views
}
Pretty silly...
Upvotes: 0
Reputation: 16138
you can just hide it,
- (IBAction)celebritiesButtonPressed:(id)sender {
self.button.alpha = 0;
//[self.peopleButton removeFromSuperview]; //as you intend
}
Upvotes: 1