开发者

iphone : Where to write this code?

Actually I am new to iphone development and want to implement Toast for this I find a stackoverflow post Android Toast in iPhone?

Now the problem is, here a code is given in one post for Toast but I donot know that in which type of file i need to write this code to work...

using System;
using System.Drawing;
using MonoTouch.UIKit;
namespace General
{

    public class ToastSettings
    {
        public ToastSettings ()
        {
            this.Duration = 500;
            this.Gravity = ToastGravity.Center;
        }

        public int Duration
        {
            get;
            set;
        }

        public double DurationSeconds
        {
            get { return (double) Duration/1000 ;}

        }

        public ToastGravity Gravity
        {
            get;
       开发者_运维问答     set;
        }

        public PointF Position
        {
            get;
            set;
        }    

    }
}


You code is in Java, and in iPhone development you cant simply add that code in. You will need to convert it into Objective C and use it then. As to where this code will be placed, you can either create a separate file for it and reference it in your delegate or you can simply place this in your delegate itself(not recommended).

However, looking at the post you linked, you should simply use this: http://code.google.com/p/toast-notifications-ios/wiki/HowToUse

It has the details and code on how to use Toast in iPhone development and even has the code done up in objective C.

If you are new to iPhone development I suggest you go through the tutorials: https://stackoverflow.com/questions/1939/how-to-articles-for-iphone-development-and-objective-c

first and learn how to use xcode and Objective C properly. Once you are comfortable with the IDE, I am sure you can code and create your project easily.


Did you look at http://code.google.com/p/toast-notifications-ios/source/browse/trunk/ ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜