UIResponder inputView与inputAccessoryView

iOS自定义软键盘-UIInputView-UIKeyInput iOS自定义软键盘-UIInputView-UIKeyInput,支持 字母、数组、符号,3种类型的键盘输入; 立即下载

看完以后觉得使用还是很方便的.

同时代码中还有UITextField的leftView与rightView示例.




代码:

//
//  main.m
//  ControlDemo
//
//  Created by watsy0007 on 12-6-3.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>

#define BARBUTTONITEM(title,act) [[[UIBarButtonItem alloc] initWithTitle:title \
style:UIBarButtonItemStylePlain \
target:self \
action:act] autorelease];

@interface KeyboardAccessoryView : UIView <UIInputViewAudioFeedback> {
}

@end

@implementation KeyboardAccessoryView

- (BOOL) enableInputClicksWhenVisible {
    return YES;
}

- (void) playClickForCustomKeyTap {
    [[UIDevice currentDevice] playInputClick];
}

@end

//--------------------------------------------------------------------------------------------
#pragma mark -
#pragma mark ViewController()

@interface ViewController : UIViewController <UITextFieldDelegate,UIWebViewDelegate> {
    UITextField     *_txtField;
    UIWebView       *_webView;
}

@property (nonatomic,retain) UIView *inView;

@end


@implementation ViewController

@synthesize inView;

- (void) dealloc {
    [_txtField release];
    if ([_webView isLoading]) {
        [_webView stopLoading];
        [_webView release];
    }
    [super dealloc];
}

- (void) inputOrAccessory: (id) sender {
    if (_txtField.inputView == nil) {
        _txtField.inputView = [self inView];
        _txtField.inputAccessoryView = nil;
    } else {
        _txtField.inputView = nil;
        _txtField.inputAccessoryView = [self inView];
    }
    
    [_txtField reloadInputViews];
    
    if ([_txtField isFirstResponder]) {
        [_txtField resignFirstResponder];
        [_txtField becomeFirstResponder];
    }
}

- (void) viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"demo";
    
    self.navigationItem.rightBarButtonItem = BARBUTTONITEM(@"input/Accessory", @selector(inputOrAccessory:));
    
    _txtField = [[UITextField alloc] initWithFrame:CGRectMake(10, 25, 300, 35)];
    _txtField.delegate = self;
    _txtField.borderStyle = UITextBorderStyleRoundedRect;
    [self.view addSubview:_txtField];
    
    _webView = [[UIWebView alloc] initWithFrame:CGRectMake(10, 65, 300, 400)];
    [self.view addSubview:_webView];
    [_webView setDelegate:self];
    
    [_webView loadHTMLString:@"<input type=\"text\" size=\"30\" autocorrect=\"off\" autocapitalization=\"on\">default keyboard</input><br><input type=\"tel\">tel keyboard</input>" baseURL:nil];
    
    
    _txtField.inputView = [self inAView];
}

- (void) completeCurrentWord:(id) sender {
    [[UIDevice currentDevice] playInputClick];
}

- (UIView *)inAView {
    if (!inView) {
        CGRect accessFrame = CGRectMake(0.0, 0.0, 320.0, 50.0);
        inView = [[KeyboardAccessoryView alloc] initWithFrame:accessFrame];
        inView.backgroundColor = [UIColor blueColor];
        UIButton *compButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        compButton.frame = CGRectMake(80, 10.0, 160, 30.0);
        [compButton setTitle: @"watsy0007" forState:UIControlStateNormal];
        [compButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [compButton addTarget:self action:@selector(completeCurrentWord:)
             forControlEvents:UIControlEventTouchUpInside];
        [inView addSubview:compButton];
    }
    return inView;
}

- (void) viewDidUnload {
    if ([_webView isLoading]) {
        [_webView stopLoading];
        [_webView release];
    }
    [super viewDidUnload];
}
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    return YES;
}

- (void) showWeb:(id) sender {
    [_txtField resignFirstResponder];
    NSString *sURL = nil;
    if (![_txtField.text hasPrefix:@"http://"]) {
        sURL = [NSString stringWithFormat:@"http://%@",_txtField.text];
    } else {
        sURL = _txtField.text;
    }
    [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:sURL]]];
}

#pragma mark -
#pragma mark field delegate
- (void) textFieldDidBeginEditing:(UITextField *)textField {
    if (textField == _txtField) {
        UILabel *lbl = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 45, 21)];    
        lbl.backgroundColor = [UIColor clearColor];
        lbl.textColor = [UIColor lightGrayColor];
        lbl.text = @"url:";
        
        textField.borderStyle = UITextBorderStyleRoundedRect;
        textField.leftViewMode = UITextFieldViewModeAlways;    
        textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
        textField.leftView = lbl;
        [lbl release];
        
        UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
        [button setTitle:@"Go" forState:UIControlStateNormal];
        [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        textField.rightView = button;
        [button addTarget:self action:@selector(showWeb:) forControlEvents:UIControlEventTouchUpInside];
        textField.rightViewMode = UITextFieldViewModeAlways;
        [button release];
    }
}

- (void)textFieldDidEndEditing:(UITextField *)textField {
    
    if (textField == _txtField) {
        textField.leftView = nil;
        textField.rightView = nil;
    }
    // remainder of implementation....
}

#pragma mark -
#pragma mark web view delegate
- (void) webViewDidFinishLoad:(UIWebView *)webView {
    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}

- (void) webViewDidStartLoad:(UIWebView *)webView {
    [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
}

- (void) webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
    NSLog(@"error :%@",error);
}

@end


//-----------------------------------------------------------------------------------------------------

#pragma mark -
#pragma mark AppDelegate
@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UIViewController *viewController;

@end

@implementation AppDelegate

@synthesize window = _window;
@synthesize viewController = _viewController;

- (void) dealloc {
    [_window release];
    [_viewController release];
    
    [super dealloc];
}

- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    srand(time(NULL));
    
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    
    self.viewController = [[ViewController alloc] init];
    
    UINavigationController *controller = [[UINavigationController alloc] initWithRootViewController:self.viewController]; 
    self.window.rootViewController = controller;
    [controller release];
    
    [self.window makeKeyAndVisible];
    return YES;
}

@end

int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}


【正点原子I.MX6U-MINI移植篇】Ubuntu-base根文件系统移植构建过程详解(四) 能不能在ARM板上运行Ubuntu呢?答案肯定是可以的,Ubuntu是Linux系统的一种,可以简单的将Ubuntu理解为一个根文件系统,和我们用busybox、buildroot制作的根文件系统一样。因此移植Ubuntu也就是将Ubuntu根文件系统移植到我们的开发板上。 阅读详情

相关推荐

ANSYS WB 网格划分详解与技巧

本文详细介绍了网格操作中的关键设置与功能选项。主要内容包括:1)网格显示风格与物理偏好设置;2)单元阶次选择对精度的影响;3)单元尺寸控制方法;4)尺寸调整功能,重点讲解了自适应尺寸调整、增长率控制和捕获曲率等选项;5)网格质量评估标准;6)四种主要划分方法(四面体、六面体主导、扫掠、多区域)的特点与适用场景;7)三种尺寸调整方式(直接调整、边缘尺寸调整、影响范围调整)的具体应用。文章强调在实际建模中需要根据模型特点合理选择网格参数,平衡计算精度与效率。

2403_87939837的博客 1701

UIInputViewController为基础的自定义键盘

iOS8系统中开放了自定义输入法。主要是用UIInputViewController来创建自定义的键盘。自定义键盘的界面放在UIInputVieController的inputView属性中。 Xcode6提供了一个建立自定义键盘的入口---自定义键盘目标模版。 自定义键盘的基本数据结构如下: 自定义的输入法模板包含一个UIInputViewController 的子类,

lcl130的专栏 9684

保姆级教程:在STM32CubeIDE上快速部署micro_ros到STM32F407(附常见问题解决)

本文提供了一份详细的保姆级教程,指导开发者如何在STM32CubeIDE上快速部署micro_ros到STM32F407微控制器。内容涵盖从Windows与Ubuntu双环境搭建、micro-ROS静态库编译、STM32CubeIDE工程深度集成,到串口通信联调与常见问题解决的完整流程,旨在帮助读者构建稳定可靠的ROS2与嵌入式设备通信系统。

o4p5q6r7s的博客 324

SwiftUI UIInputViewController 基础教程

UIInputViewController 自定义键盘应用程序扩展的主视图控制器。 class UIInputViewController : UIViewController 使用教程 要创建自定义键盘,请首先对UIInputViewController类进行子类化,然后将键盘的用户界面添加到子类的inputView属性中。在Xcode中,您可以通过选择“自定义键盘”目标模板来启动自定义键盘。...

iCloudEnd的博客 1484

对冲策略与马丁结合ea的编程实践(五)核心是把两个品种合成一个新品种

在外汇、数字货币、期货交易甚至赌博中,马丁策略、网格策略是最常用的策略,也是最容易被理解的策略,但是如何克服单边行情、极端行情,是使用马丁策略最为头疼的事情,如加大间距、加大资金量,只能缓解,并不能根本解决这样的情况,所以使用时大部分时候都心里没底。 有没有一种正确的思路,让行情控制在震荡范围以内呢,这是今天我要向大家分享的一个思路,那就是对冲。大家看下图: 大家可以看到欧美(EURUSD)和镑美(GBPUSD),这两个品种,大部分时候走势是一致的,那么我们有没有可能把他们两个品种进行一下合成,比如买0.

omidsky的博客 3742

【Azure 架构师学习笔记】- Azure Private Endpoint

公有云的其中一个特点是默认允许公网访问, 这就对企业环境带来风险,也是很多年前企业对公有云抵触的其中一个原因,现在这类问题已经很少,因为有了很多技术来确保云上的资源被安全地访问。其中Private endpoint(PE)就起到了很重要的作用。云上的某个资源如VM会创建在特定的网络(VNet/Subnet)上, 而其他如Storage Account , Azure SQL等PaaS服务则没有。如果你需要用VM 来访问这些PaaS资源,VM 就会通过资源的公网IP 来访问。

MVP黄钊吉(發糞塗牆) 1791

iOS键盘 inputView 和 inputAccessoryView

1.inputAccessoryView UITextFields和UITextViews有一个inputAccessoryView的属性,当你想在键盘上展示一个自定义的view时,你就可以设置该属性。你设置的view就会自动和键盘keyboard一起显示了。 需要注意的是,你所自定义的view既不应该处在其他的视图层里,也不应该成为其他视图的子视图。其实也就是说,你所自定义的...

小天空的博客 4591

黑马程序员Pink的javaScript课程APIday4

本文摘要:介绍了JavaScript中日期对象的实例化方法(有参/无参)及三种获取时间戳的方式。讲解了DOM节点操作,包括节点查找(父、子、兄弟节点)、增加/克隆/删除节点的方法。详细说明了移动端touch事件和Swiper插件的使用,包括自动播放和小圆点配置。最后提及学成在线案例中表单验证和取消默认跳转的实现。

JLY19970726的博客 826

自定义键盘

自定义键盘的两种需求: 1. 在系统键盘上增加一些按钮 2. 用写自己的键盘这就要涉及到UIResponder的各种属性了。所有的支持事件响应的控件都是UIResponder的子类。UIResponder中定义了很多属性来共同设置当一个控件becomeFirstResponder的时候如何响应。这些属性都是只读的。我们要使用这些属性,通常要在自定义的控件中重新定义这些属性,并且可读可写,然后给他

ohyeahhhh的博客 2892

三相电机控制中的端电压、相电压与线电压波形解析

本文深入解析了三相电机控制中端电压、相电压与线电压的核心概念与波形差异。通过对比方波控制、SPWM和SVPWM三种主流控制策略下的实测波形特征,揭示了不同控制逻辑对电压波形(如梯形波、正弦波、马鞍波)的影响。文章重点阐述了SVPWM控制如何通过生成马鞍波形端电压来提高直流母线电压利用率,并提供了实用的波形测量与调试指南,帮助工程师深入理解电机控制原理并进行有效调试。

qsc901234567的博客 1403

Google Earth Engine(GEE)—— 显示如何使用迁移的训练样本进行多年分类的脚本(sentinel-2影像为例)光谱差异()

HydroSHEDS 是一种地图产品,它以一致的格式为区域和全球范围的应用程序提供水文信息。它提供了一套不同比例的地理参考数据集(矢量和栅格),包括河流网络、流域边界、排水方向和流量累积。请注意,对于北纬 60 度以上的地区,HydroSHEDS 数据的质量明显较低,因为没有可用的基础 SRTM 高程数据,因此分辨率较低的 DEM(USGS 提供的 HYDRO1k)。该数据集基于 15 角秒(赤道约 500 米)分辨率栅格数据提供嵌套的分层分水岭多边形。光谱信息和之前不同的点:训练结果。

此星光明博客 967

ios 输入法扩展_iOS8新特性扩展(Extension)应用之四——自定义键盘控件

iOS8新特性扩展(Extension)应用之四——自定义键盘控件iOS8系统的开放第三方键盘,使得用户在输入法的选择上更加自主灵活,也更加贴近不同语言的输入风格。这篇博客,将介绍如何开发一个第三方的键盘控件。一、了解UIInputViewController类UIInputViewController是系统扩展支持键盘扩展的一个类,通过这个类,我们可以自定义一款我们自己的键盘提供给系统使用。首先...

weixin_39581739的博客 399

cdk&java | 分子sdf文件生成

sdf

ASKCOS博客 1090

iOS--inputView和inputAccessoryView

iOS–inputView和inputAccessoryView 什么是inputView和inputAccessoryView? 如果是UITextField和UITextView,下面是声明文件源代码: // set while first responder, will not take effect until reloadInputViews is call...

weixin_30741653的博客 272

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

iOS框架研究 之 UIResponder 可以接收事件的对象(一)

1. 简介: 此类继承自NSObject 所属的框架: /System/Library/Frameworks/UIKit.framework 定义了一些接口对象,然后响应事件,它是 UIApplication, UIView 和UIWindow等的父类 iOS 中,所有显示在界面上的对象都是从 UIResponder 直接或间接继承的。 最新版本的iOS中有三

andy_jiangbin的专栏 519

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

UITextView和UITextField的使用小技巧

其實應該是要說UIResponder才對, 不過範圍好像大了點, 為了偷懶, 就只記錄最近開發過程一些使用的技巧。 (via http://blog.fashionguide.com.tw/602/posts/38191-iDM) 以上面的圖片內容作為參考, 在做這個畫面互動的時候, 我想我會用數個按鈕(UIButton)點下去後, 在將UIPickerView顯示出來

u011025344的专栏 542

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

UIResponder详解

UIResponder Class Reference Managing the Responder Chain [plain] view plaincopy 1.- (UIResponder *)nextResponder   返回接收者的下一个相应,如果没有就返回nil UIResponder类不自动存储和设置下一个响应者,而是默认

IOS研究专栏 1337

IQKeyboardManager 内存管理完整指南:键盘不遮挡、资源不泄漏的6个关键动作

你的输入框明明就在屏幕下方,键盘一弹出来却被挡得严严实实;更头疼的是,明明只是正常地来回切换页面,App 却频繁收到内存警告,甚至偶尔闪退。如果你正在用 **IQKeyboardManager** 处理键盘遮挡问题,却对它的内存管理机制一知半解,这篇文章就是为你准备的。IQKeyboardManager 是一款免代码、即插即用的键盘管理库,能自动避免键盘上滑遮挡 UITextField/UITex

gitblog_00291的博客 314

如何让UIViewController自动弹出PickerView

因为响应者的一下属性inputView和inputAccessoryView都是只读的,所以如果想要指定弹出的view就要override 下面两个属性的get和set方法 UIResponder (UIResponderInputViewAdditions) @property (readonly, retain) UIView *inputView NS_AVAILABLE_IOS(

SpeedBoy007的专栏 1408

谈UITextView、UITextField的InPutView和AccessoryInputView的便利

无论是富媒体输入还是聊天表情输入,都经常切换系统键盘和自定义输入View。跟Android不一样的是,iOS需要在输入控件如UITextView聚焦才能出现键盘,默认情况下一旦输入控件失焦点有没有切换到其他输入控件的时候,键盘随之消失。尽管,可以通过text属性添加响应内容,但是没有光标的位置提示总是个缺陷。如腾讯的微信和手Q的iOS版都是没有很好处理光标问题,特别是微信iOS版的表情输入还是显示“

1372

隐藏WKWebview键盘工具条(inputAccessoryView)的原理是什么,如何隐藏后再显示?

隐藏WKWebview键盘工具条的代码很多,比如 https://www.jb51.net/article/162546.htm 但是没有说明原理的。 昨天研究了一下,原理是:动态新建一个WKWebview的子类YYY_UIView,这个子类重写-inputAccessoryView方法,再把WKWebview这个类换成YYY_UIView。 注意:这个实际的.h和.m是可以随便命名的,比如YYYYNoInputAccessoryView.h ,不要定义为WKWebview的分类或者其他..

qq_15509071的博客 1624

IOS学习笔记(六)inputAccessoryView,inputView

我们在使用UITextView和UITextField的时候,可以通过它们的inputAccessoryView属性给输入时呼出的键盘加一个附属视图,通常是UIToolBar,用于回收键盘。 但是当我们要操作的视图不是UITextView或UITextField的时候,inputAccessoryView就变成了readonly的。 这时我们如果还想再加inputAccessoryView,按

u010850094的博客 485

iOS开发inputView和inputAccessoryView

在UITextField和UITextField中能查到这两个属性 @property (readwrite, retain) UIView *inputView; @property (readwrite, retain) UIView *inputAccessoryView; 在UITextField或者UITextField成为默认响应的时候,会弹出系统键盘。如果对这两个控件的inpu

MinggeQingchun的博客 5015

WKWebView自动弹出键盘和隐藏输入附属视图(inputAccessoryView)

自动弹出键盘 在UIWebView中,有一个属性keyboardDisplayRequiresUserAction,设置为NO时就可以在页面刚加载时直接弹出键盘;在WKWebView中,是没有这个属性的,如果要实现类似的功能,就必须替换WKWebView中相应的方法,代码如下: static void (*originalIMP)(id self, SEL _cmd, void

欢迎来到Jack的程序世界 9105

ios开发-inputView和inputAccessoryView

在UITextField或者UITextField成为默认响应的时候,会弹出系统键盘。如果对这两个控件的inputView属性设置了自定义的view,在其成为第一响应的时候系统键盘将不再弹出,取而代之的是赋值给inputView的那个view。inputAccessoryView是键盘的辅助视图,即键盘上面那部分。同样当对inputAccessoryView设置了自定义view时,键盘弹出的同时,该view会作为辅助

Lotheve的私房菜 7936

inputAccessoryView

我们在使用UITextView和UITextField的时候,可以通过它们的inputAccessoryView属性给输入时呼出的键盘加一个附属视图,通常是UIToolBar,用于回收键盘。 但是当我们要操作的视图不是UITextView或UITextField的时候,inputAccessoryView就变成了readonly的。 这时我们如果还想再加inputAccessoryVi

iamfreedom2011的专栏 868
上一篇: UiTableView 使用技巧1 (datamodel与datasource独立)
下一篇: iOS 5 新增的UIPageViewController 简单示例
watsy
博客等级 码龄19年 133粉丝 104原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值