There are a variety of ways in which you can do this. What I post below is my second attempt, which I think is simplest here. Have a block in your vc, something like
@property (nonatomic,strong) void ( ^ appearBlock )();
and then use that to do whatever you want next time the view appears. The first time this will be nil and will not execute, then when you call the code you posted also do something like
__weak myVc * weakSelf = self;
self.appearBlock = ^ { weakSelf.edit.text = nil; };
// Code you posted, where you present your popover
[rootController popToViewController...
and in your viewWillAppear
- ( void ) viewWillAppear ...
{
[super viewWillAppear...
if ( self.appearBlock )
{
// Execute block
self.appearBlock();
// Ensure we never call it again
self.appearBlock = nil;
}
.. rest of view will appear ..
}
EDIT
The trouble here is that, depending on the iOS you use and how you present the vc, a number of things are called or not called when the view is presented or dismissed.
Depending on that you may have to move the call to the appearBlock
to different places. The popover delegate can be used but I don't think iOS 9 supports that, then for popovers you also have the beingPresented / beingDismissed
messages.