8

Unrecognized selector sent to instance 0x84b1c20 '- How to stream from UIVIEW to...

 3 years ago
source link: https://www.codesd.com/item/unrecognized-selector-sent-to-instance-0x84b1c20-how-to-stream-from-uiview-to-uiviewcontroller.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Unrecognized selector sent to instance 0x84b1c20 '- How to stream from UIVIEW to UIViewController

advertisements

what's the way that i can resolve it.

  NavigationControllerWithSlider* controller = (NavigationControllerWithSlider*) self.ViewLocations;    // ViewLocations ----> subView of ViewController && NavigationControllerWithSlider is a ViewController .

 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setRightSlidingViewWithSliderImage:length:]: unrecognized selector sent to instance 0x805df60'
*** First throw call stack:
(0x1bec012 0x1508e7e 0x1c774bd 0x1bdbbbc 0x1bdb94e 0x19f7c 0x90d1c7 0x90d232 0x90d4da 0x9248e5 0x9249cb 0x924c76 0x924d71 0x92589b 0x925e93 0x925a88 0xb9a6 0xb3e8 0xaf40 0x8db285 0x8db4ed 0x44c5b3 0x1bab376 0x1baae06 0x1b92a82 0x1b91f44 0x1b91e1b 0x1b467e3 0x1b46668 0x82bffc 0x86dd 0x22b5)
libc++abi.dylib: terminate called throwing an exception
(lldb)

Here is my Code:

//ViewController.m

NavigationControllerWithSlider* controller = (NavigationControllerWithSlider*) self.ViewLocations;    // ViewLocations ----> subView of ViewController
    UIImage * img = [UIImage imageNamed: @"open_panel.png"];
    UIImage * closeImg = [UIImage imageNamed: @"close_panel.png"];

    UIImage * img1 = [UIImage imageWithCGImage:img.CGImage scale:img.scale orientation:UIImageOrientationUpMirrored];
    UIImage * closeImg1 = [UIImage imageWithCGImage:closeImg.CGImage scale: closeImg.scale orientation:UIImageOrientationUpMirrored];

    [controller setRightSlidingViewWithSliderImage:img1 length:300.0f];
    controller.rightSlidingViewControllerId = @"toBeEmbeddedRight";
    controller.rightSlidingView.hideSliderImage = closeImg1;
    controller.rightSlidingView.headPadding = 44.0f;
    controller.rightSlidingView.trailPadding = 44.0f;


//NavigationControllerWithSlider.m

- (void) setRightSlidingViewWithSliderImage: (UIImage*) image length: (CGFloat) length {
    _rightSlidingView = [[SlidingViewController alloc] initWithPosition: DDSliderPositionRight image: image length: length];
    _rightSlidingViewControllerId = @"";
}

What I'm missing here.. ? Any help plz....


So, you have to set the instance of your NavigationControllerWithSlider explicitly to client view controller. To do that, you can use this or similar approach:

@interface NavigationControllerWithSlider : UINavigationController

// some custom interface
// ..

- (void)setRightSlidingViewWithSliderImage:(UIImage *)image length:(CGFloat)length;

@end

// this is the main controller with strong property of NavigationControllerWithSlider instance
@interface MainRootViewController

@property (nonatomic, strong) NavigationControllerWithSlider *sliderController;

@end

@implementation MainRootViewController

- (id)init {
    self = [super init];
    if (self) {
        _sliderController = [NavigationControllerWithSlider new];
    }

    return self;
}

- (void)presentPopup {
    SomeController *newControllerForPopup = [[SomeController alloc] init];
    newControllerForPopup.sliderController = self.slider;

    // present controller and use slider ^ that you've set here explicitly
}

@end

// here is an example of using and declaring of public property
@interface SomeController : UIViewController

@property (nonatomic, weak) NavigationControllerWithSlider *sliderController;

@end

@implementation SomeController

- (void)viewDidLoad {
    [super viewDidLoad];

    // do some additional view configuration using self.sliderController
}

@end


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK