Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First of all, create an iPhone app. Create your UI and other things accordingly.</p> <p>Second, add a C file to your project, do your logic there. Since main() is not the entry point for your app, you need to get your code logic modified and organized into methods.</p> <p>Third, add the reference to the C file you created in the place where you wanna use the logic.</p> <p>Last, call the method directly and that's about it.</p> <hr> <p>Here is a little example I tried:</p> <ol> <li><p>I created an iPhone single view project getCNumber.</p></li> <li><p>I added two files to the project: Number.h and Number.m</p></li> </ol> <p>in Number.h:</p> <pre><code> #include &lt;stdio.h&gt; int getNum(); </code></pre> <p>in Number.m:</p> <pre><code> #include "Number.h" int getNum() { return 234; } 3. In getCNumber.xib, I have a label. </code></pre> <p>In getCNumber.h,</p> <pre><code> #import &lt;UIKit/UIKit.h&gt; @interface getCNumber : UIViewController { UILabel *lblNum; } @property (nonatomic, retain) IBOutlet UILabel *lblNum; @end </code></pre> <p>in getCNumber.m, in -(void)viewDidLoad(),</p> <pre><code> - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. int someNum = getNum(); self.lblNum.text = [NSString stringWithFormat:@"Number from C: %i",someNum]; } </code></pre> <p>You might need to do some extra work to get your C program going with the iOS "wrapper", as I don't know exactly what you did in your C, but this should show you the general idea here.</p> <p>Hope it helps.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload