iOS Question Obj C Class and #IF OBJC / An attempt at ViewBadger functionality for iOS

Discussion in 'iOS Questions' started by henrywood, Apr 24, 2015.

  1. henrywood

    henrywood Active Member Licensed User

    In the Android version of my app, I use ViewBadger to put a badge on buttons.
    Now I try to do the same in iOS.
    I found this Objective C Class:

    My question is: Can I use that class by importing the NimbusBadge.h from within an #IF OBJC block in B4i, define a wrapper in Objective C to set a badge on a view and then write a B4i Sub that wraps the Objective C wrapper method ?

    Something like this:

    #IF OBJC
    #import "NimbusBadge.h"

    - (void) setBadgeViewInternal:(NSString*)txt :(UIColor*)bgColor :(UIView*)viewButton
    NIBadgeView* badgeView = [[NIBadgeView alloc] initWithFrame:CGRectZero];
    badgeView.text = txt;
    badgeView.tintColor = bgColor;
    [badgeView sizeToFit];
    [viewButton addSubview:badgeView];

    #END IF

    Sub setBadgeView(txt As String, bgColor As Color, v As View)

    Dim no As NativeObject = Me
    "setBadgeViewInternal:::"Array As Object(txt, no.ColorToUIColor(bgColor), v))

    End Sub
    And calling the B4i sub:

    Dim btn As Button
    btn.Text = 
    "Click Me"
    "7"Colors.Blue, btn)
    If this is possible, where do I place any .h and .m files of NimbusBadge so that they are included in my project ?
    Last edited: Apr 24, 2015
  2. Erel

    Erel Administrator Staff Member Licensed User

    You will need to put the .h and .a (compiled object) files in the server libs folder.

    You will then need to modify one of the libraries xml file and add a DependsOn node with the new library.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice