iOS Question Inline OBJC

narek adonts

Well-Known Member
Licensed User
Longtime User
Hi I am trying to add this objs code but the CustomView is not returning a UIView

B4X:
@end


@interface CustomView  : UIView

// Override inputAccessoryView to readWrite
@property (nonatomic, readwrite, retain) UIView *inputAccessoryView;
   
@end

@implementation CustomView

// Override canBecomeFirstResponder
// to allow this view to be a responder
- (BOOL) canBecomeFirstResponder {
    return YES;
}

// Override inputAccessoryView to use
// an instance of KeyboardBar
- (UIView *)inputAccessoryView {
    if(!_inputAccessoryView) {
    CGRect screen = [[UIScreen mainScreen] bounds];
    CGRect frame = CGRectMake(0,0, CGRectGetWidth(screen), 40);
        _inputAccessoryView = [[UITextView alloc]initWithFrame:CGRectMake(5, 5, frame.size.width - 70, frame.size.height - 10)];
    }
    return _inputAccessoryView;
}

#end if

Any advice?
 

narek adonts

Well-Known Member
Licensed User
Longtime User
B4X:
Application_Start
Error occurred on line: 46 (Main)
+[CustomView _setViewDelegate:]: unrecognized selector sent to class 0xc5e58
Stack Trace: (
  CoreFoundation       <redacted> + 154
  libobjc.A.dylib      objc_exception_throw + 38
  CoreFoundation       <redacted> + 0
  CoreFoundation       <redacted> + 700
  CoreFoundation       _CF_forwarding_prep_0 + 24
  UIKit                <redacted> + 34
  UIKit                <redacted> + 460
  Foundation           <redacted> + 236
  UIKit                <redacted> + 70
  B4i Example          -[B4INativeObject SetField::] + 130
B4i Example          -[b4i_main _application_start:] + 1880
CoreFoundation       <redacted> + 68
CoreFoundation       <redacted> + 294
B4i Example          +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1784
B4i Example          -[B4IShell runMethod:] + 574
B4i Example          -[B4IShell raiseEventImpl:method:args::] + 1998
B4i Example          -[B4IShellBI raiseEvent:event:params:] + 1442
B4i Example          __33-[B4I raiseUIEvent:event:params:]_block_invoke + 74
libdispatch.dylib    <redacted> + 10
libdispatch.dylib    <redacted> + 22
libdispatch.dylib    _dispatch_main_queue_callback_4CF + 890
CoreFoundation       <redacted> + 8
CoreFoundation       <redacted> + 1422
CoreFoundation       CFRunLoopRunSpecific + 486
CoreFoundation       CFRunLoopRunInMode + 104
GraphicsServices     GSEventRunModal + 156
UIKit                <redacted> + 574
UIKit                UIApplicationMain + 150
B4i Example          main + 108
libdyld.dylib        <redacted> + 2
)
Application_Active
 
Upvote 0

narek adonts

Well-Known Member
Licensed User
Longtime User
One more issue.

How can I pass a regular textview created with b4i to _inputAccessoryView =
something like _inputAccessoryView = b4i_main._txt.object but without success.


Done )))

n.setField("inputAccessoryView",myView)
 
Last edited:
Upvote 0

Similar Threads

Top