iOS Dev (7) Single View App

Mac OS X 10.8

iOS 7 SDK

Xcode5


1. Command + Shift + N: 创建一个iOS Project,选择Single View Application。Xcode会自动帮助创建一个UIViewController子类及相应的Storyboard。

2. 拖动一个UIButton控件到Storyboard中。

3. 按住Control拖动该button到UIViewController子类的头文件(.h)中。

4. Connection选择Action,Name写showAlert,Type选择id或UIButton,Event选TouchUpInside,Arguments选Sender。

5. 在UIViewController子类的源文件中的showAlert方法中添加如下代码:

    [[[UIAlertView alloc] initWithTitle:@"您好,苍老师"
                                message:@"听说您的新贴转发了 499次"
                               delegate:nil
                      cancelButtonTitle:@"我来帮转1次,你懂的"
                      otherButtonTitles:nil, nil]show];

6. Command + R:运行后点击按钮看效果。



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值