Wrapping Cocoa Touch
Monkey Targets Forums/iOS/Wrapping Cocoa Touch| 
 | ||
| Im currently trying to wrap some cocoa Touch functions to use the original ios Interface without Interface Builder Maybe someone give it a try on OSX (i only have a mac on work :/ have to buy one ^^) This will flow into imonk if ready Import "native/ios.cpp" 'contains native cpp code Extern Function CreateTextField(placeholder$, x1#, y1#, x2#,y2#) Function CreateScrollView(ScrollViewWidth#,ScrollViewHeight#,ContentWidth#, ContentHeight#) 
// Native Code in native/ios.cpp
void CreateTextField(String placeholder, float x1,float y1, float x2, float y2)
 {
    UITextField    *textfield;
    NSString *placeholderStr = placeholder.ToNSString();
    // Create textfield 
    textfield = [[UITextField alloc] initWithFrame:CGRectMake(x1, y1, x2, y2)];
    textfield.placeholder = placeholderStr;
    textfield.delegate = self;
    textfield.returnKeyType = UIReturnKeyDone;
    textfield.borderStyle = UITextBorderStyleBezel;
    textfield.enablesReturnKeyAutomatically = TRUE;
    // Add Subview to mojo window
    [self.view addSubview:textfield];
}
void CreateScrollView(float ScrollViewWidth, float ScrollViewHeight, float ContentWidth, float ContentHeight)
 {
    // Create scrollview
    scrollview = [[UIScrollView alloc] init];      
    scrollview.contentSize = CGSizeMake(ContentWidth, ContentHeight);
    scrollview.frame = CGRectMake(0, 0, ScrollViewWidth, ScrollViewHeight);
    scrollview.scrollsToTop = NO;
    scrollview.delegate = self;
    [self.view addSubview:scrollview];
}
 |