iOS--圆角按钮

//进入按钮
    UIButton *enterMainButton = [[UIButton alloc] initWithFrame:CGRectMake(65, self.PageHeight-120,250 , 45)];
    enterMainButton.layer.borderWidth = 1;
    enterMainButton.layer.cornerRadius = 24;
    enterMainButton.layer.borderColor = [UIColor colorWithRed:108/255.0 green:122/255.0 blue:149/255.0 alpha:1].CGColor;
    [enterMainButton setTitle:@"进入应用" forState:UIControlStateNormal];
    enterMainButton.titleLabel.font = [UIFont systemFontOfSize: 14.0];
    [enterMainButton setTitleColor:[UIColor colorWithRed:108/255.0 green:122/255.0 blue:149/255.0 alpha:1]forState:UIControlStateNormal];

    enterMainButton.showsTouchWhenHighlighted = YES;
    enterMainButton.alpha = 0;

    [enterMainButton addTarget:self action:@selector(intoButtonClick:) forControlEvents:UIControlEventTouchUpInside];

    [UIView animateWithDuration:3.0 animations:^{
        enterMainButton.alpha = 1.0;
    }];
时间: 2024-07-31 19:33:26

iOS--圆角按钮的相关文章

iOS中创建自定义的圆角按钮

iOS中很多时候都需要用到指定风格的圆角按钮,尽管UIButton提供了一个方式创建圆角按钮: + (id)buttonWithType:(UIButtonType)buttonType;//指定buttonType为UIButtonTypeRoundedRect 但是这样创建出来的按钮仅仅能支持默认的白底蓝字的风格,不可再进行更改.比如更改了backgroundColor,背景颜色区域仍然覆盖了整个矩形区域. 怎么做呢,通过摸索,以下方法能达到要求: UIButton *btn = [[UIB

iOS UIButton按钮

系统字体 + ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]]; NSArray *fontNames; NSInteger indFamily, indFont; for (indFamily=0; indFamily<[familyNames count]; ++indFamily) {     NSLog(@"Fa

Android 自定义UI圆角按钮

Android实际开发中我们一般需要圆角的按钮,一般情况下我们可以让美工做出来相应的按钮图片,然后放上去即可,另外我们可以在布局文件中直接设置,也可以达到一样的效果.下面讲解在布局文件中自定义圆角按钮的小Demo. 代码很简单,实现效果图: 源代码: 源代码: 这里主要是xml布局文件实现: MainActivity: package com.android_drawableresource; import android.app.Activity; import android.os.Bund

Android如何设置圆角按钮

1. 在res目录下的drawable目录下新建shape.xml文件 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <!-- 填充的颜色 --> <solid and

jQuery Mobile(jqm)按钮的隐藏和显示,包括a标签,圆角和非圆角按钮

在移动互联网时代,HTML5开发越来越收到欢迎.于是各种HTML5的框架都出来了.由于对于jquery的熟悉,jquery mobile 为多数人选择学习的对象.我也是众多追求者之一.最近一直在开发jQuery Mobile的相关应用.并颇有心得,再这里和大家一起分享一下. 好了,我们之间上代码: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head>

自定义圆角按钮

//放置按钮 //登录 _loginButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; _loginButton.frame = CGRectMake(20, 300, 280, 35); _loginButton.backgroundColor = [UIColor blueColor]; [_loginButton setTitle:@"登录" forState:UIControlStateNormal]; //自

win10 uwp 圆角按钮

本文讲的是如何做圆角按钮,我们在UWP本来的按钮都是矩形,圆角Radius没有,所以本文就用简单方法去做圆角按钮. 我们按钮需要圆角,而自带没有,其实做一个很简单,把原来的按钮变为背景透明,然后使用矩形圆角,这样就是圆角按钮. 按钮背景颜色透明,那么我们可以使用Background="{x:Null}"这时我们没有了背景,可以在按钮使用矩形圆角,然后写上我们需要的显示,当然上面图就是我们做的 <Button.Content> <Grid> <Viewbox

android 带边框的圆角按钮

新建buttonstyle.xml 代码如下 <?xml version="1.0" encoding="UTF-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <!-- 连框颜色值 --><item> <shape> <solid android:color="#1

iOS 防止按钮快速点击造成多次响应的避免方法

有时候有些操作是防止用户在一次响应结束中再响应下一个.但有些测试用户就要猛点,狂点.像这种恶意就要进行防止. 当然有些异步操作时,可以在调用前enable 掉.等CallBACK 后再enable起来.过程中按钮是不能点的. 1.可以使用: - (void) timeEnough { UIButton *btn=(UIButton*)[self.view viewWithTag:33]; btn.selected=NO; [timer invalidate]; timer=nil; } - (v

纯代码实现实现各种效果的圆角按钮。

#import <UIKit/UIKit.h> @interface APRoundedButton : UIButton @property (nonatomic, assign) int style; @end // // Created by Alberto Pasca on 27/02/14. // Copyright (c) 2014 albertopasca.it. All rights reserved. // #import "APRoundedButton.h&qu