当前位置:  编程技术>移动开发
本页文章导读:
    ▪OC得Block语法施用        OC得Block语法使用 // // main.m // Block // // Created by Rayln Guan on 8/29/13. // Copyright (c) 2013 Rayln Guan. All rights reserved. // #import <Foundation/Foundation.h> typedef int (^MySum) (int, int); void test1(){ int (^Sum) .........
    ▪ constract跟 property的写法        constract和 property的写法 <beans profile="test,local">-->    <!--&lt;!&ndash; 本地,测试环境的 mail 服务配置 &ndash;&gt;-->    <!--<bean name="sendMailService" >-->    <!--<.........
    ▪ 荧屏是横向的时候,NavigationBar总是在下边       屏幕是横向的时候,NavigationBar总是在下边? 这是由于旋转时没有定位屏幕的位置,我们可以写一个旋转时的方法: -(void)rotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { switch(t.........

[1]OC得Block语法施用
    来源: 互联网  发布时间: 2014-02-18
OC得Block语法使用
//
//  main.m
//  Block
//
//  Created by Rayln Guan on 8/29/13.
//  Copyright (c) 2013 Rayln Guan. All rights reserved.
//

#import <Foundation/Foundation.h>
typedef int (^MySum) (int, int);

void test1(){
    int (^Sum) (int, int) = ^(int a, int b){
        return a + b;
    };
    NSLog(@"%i", Sum(2, 3));
}

void test2(){
    MySum sum = ^(int a, int b){
        return a + b;
    };
    NSLog(@"%i", sum(10, 2));
}

int main(int argc, const char * argv[])
{

    @autoreleasepool {
        test1();
        test2();
        
    }
    return 0;
}


    
[2] constract跟 property的写法
    来源: 互联网  发布时间: 2014-02-18
constract和 property的写法
<beans profile="test,local">-->
    <!--&lt;!&ndash; 本地,测试环境的 mail 服务配置 &ndash;&gt;-->
    <!--<bean name="sendMailService" >-->
    <!--<constructor-arg index="0"-->
    <!--type="org.apache.velocity.app.VelocityEngine"-->
    <!--ref="velocityEngine" />-->
    <!--<constructor-arg index="1"-->
    <!--type="org.springframework.mail.javamail.JavaMailSender" ref="mailSender" />-->
    <!--<constructor-arg index="2" type="java.lang.String"-->
    <!--value="${mail.from}" />-->
    <!--</bean>-->
    <!--</beans>-->


        <!-- SCE 测试环境及正式环境下 mail 服务配置 -->
        <bean name="sendMailService" >
            <constructor-arg index="0" type="org.apache.velocity.app.VelocityEngine"
                             ref="velocityEngine"/>
            <property name="from" value="****@sohu-inc.com"/>
        </bean>

@Autowired
    private VelocityEngine velocityEngine;

    private String from;

    public SendMailService() {
    }

    public SendMailService(VelocityEngine velocityEngine) {
        this.velocityEngine = velocityEngine;
    }


    public SendMailService(String from) {
        this.from = from;
    }

    
[3] 荧屏是横向的时候,NavigationBar总是在下边
    来源: 互联网  发布时间: 2014-02-18
屏幕是横向的时候,NavigationBar总是在下边?

这是由于旋转时没有定位屏幕的位置,我们可以写一个旋转时的方法:

-(void)rotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
    switch(toInterfaceOrientation)
    {
        case UIInterfaceOrientationLandscapeLeft:
            self.view.transform=CGAffineTransformMakeRotation(3.1415926*(-90));//向右旋转,顺时针旋转,弧度=度数/180*PI
            if([self.deviceType isEqualToString:@"iPad Simulator"])//真机测试时换成 iPad
            {
                self.view.bounds=CGRectMake(0.0, 0.0, 1024.0, 748.0);//重点是这句话,标明视图位置,不然NavigationBar就可能在下边
                [self loadHorizontalViewForIPad];//加载iPad水平视图
            }
            else
            {
                self.view.bounds=CGRectMake(0.0, 0.0, 480.0, 300.0);
                [self loadHorizontalViewForIPhone];//加载iPhone水平视图
            }
            break;
        case UIInterfaceOrientationLandscapeRight:
            self.view.transform=CGAffineTransformMakeRotation(3.1415926*90);//向左旋转,逆时针旋转弧度=度数/180*PI
            if([self.deviceType isEqualToString:@"iPad Simulator"])//真机测试时换成 iPad
            {
                self.view.bounds=CGRectMake(0.0, 0.0, 1024.0, 748.0);
                [self loadHorizontalViewForIPad];//加载iPad垂直视图
            }
            else
            {
                self.view.bounds=CGRectMake(0.0, 0.0, 480.0, 300.0);
                [self loadHorizontalViewForIPhone];//加载iPhone垂直视图
            }
            break;
        default:
            self.view.transform=CGAffineTransformMakeRotation(0);
            if([self.deviceType isEqualToString:@"iPad Simulator"])//真机测试时换成 iPad
            {
                self.view.bounds=CGRectMake(0.0, 0.0, 768.0, 1004.0);
                [self loadVerticalViewForIPad];
            }
            else
            {
                self.view.bounds=CGRectMake(0.0, 0.0, 320.0, 460.0);
                [self loadVerticalViewForIPhone];
            }
    }
}

 

 

    
最新技术文章:
▪Android开发之登录验证实例教程
▪Android开发之注册登录方法示例
▪Android获取手机SIM卡运营商信息的方法
▪Android实现将已发送的短信写入短信数据库的...
▪Android发送短信功能代码
▪Android根据电话号码获得联系人头像实例代码
▪Android中GPS定位的用法实例
▪Android实现退出时关闭所有Activity的方法
▪Android实现文件的分割和组装
▪Android录音应用实例教程
▪Android双击返回键退出程序的实现方法
▪Android实现侦听电池状态显示、电量及充电动...
▪Android获取当前已连接的wifi信号强度的方法
▪Android实现动态显示或隐藏密码输入框的内容
▪根据USER-AGENT判断手机类型并跳转到相应的app...
▪Android Touch事件分发过程详解
▪Android中实现为TextView添加多个可点击的文本
▪Android程序设计之AIDL实例详解
▪Android显式启动与隐式启动Activity的区别介绍
▪Android按钮单击事件的四种常用写法总结
▪Android消息处理机制Looper和Handler详解
▪Android实现Back功能代码片段总结
▪Android实用的代码片段 常用代码总结
▪Android实现弹出键盘的方法
▪Android中通过view方式获取当前Activity的屏幕截...
▪Android提高之自定义Menu(TabMenu)实现方法
▪Android提高之多方向抽屉实现方法
▪Android提高之MediaPlayer播放网络音频的实现方法...
▪Android提高之MediaPlayer播放网络视频的实现方法...
▪Android提高之手游转电视游戏的模拟操控
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3