我创建了一个新的UIViewController,我不使用故事板,这是我的代码.我想改变我的视图框架,这对我不起作用,我试图添加viewWillAppear,它仍然不起作用,我知道我可以添加一个新UIView的来做它.我可以更改viewcontroller的视图吗?谢谢你的帮助.
import UIKit
class NewDetailViewController: UIViewController {
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
}
override func viewDidLoad() {
super.viewDidLoad()
let statusBarHeight: CGFloat = UIApplication.sharedApplication().statusBarFrame.height
let navBarHeight = self.navigationController?.navigationBar.frame.size.height
println("statusBarHeight: \(statusBarHeight) navBarHeight: \(navBarHeight)")
// view
var x:CGFloat = self.view.bounds.origin.x
var y:CGFloat = self.view.bounds.origin.y + statusBarHeight + CGFloat(navBarHeight!)
var width:CGFloat = self.view.bounds.width
var height:CGFloat = self.view.bounds.height - statusBarHeight - CGFloat(navBarHeight!)
var frame:CGRect = CGRect(x: x, y: y, width: width, height: 100)
println("x: \(x) y: \(y) width: …Run Code Online (Sandbox Code Playgroud) 我用户Master-Detail创建了一个项目.在MasterViewController,表格单元格我使用MasterCell.h,并MasterCell.m建立我的自定义单元格,所以我的代码是:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
MasterCell *cell = (MasterCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell = [[MasterCell alloc] initWithFrame:CGRectZero];
NSString *value = [[myContacts objectAtIndex:indexPath.row] valueForKey:@"Name"];
cell.nameContentLabel.text = [NSString stringWithFormat:@"%@", value];
value = [[myContacts objectAtIndex:indexPath.row] valueForKey:@"Tele"];
cell.teleContentLabel.text=[NSString stringWithFormat:@"%@", value];
value = [[myContacts objectAtIndex:indexPath.row] valueForKey:@"Image"];
cell.myImageView.image = [[UIImage alloc] initWithContentsOfFile:value];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
Run Code Online (Sandbox Code Playgroud)
我想要点击单元格并按下DetailViewController,所以我的stroyboard是使用原点创建segue,但它没有工作,我认为segue不是我的MasterCell,我试图改变故事板单元格自定义类,它不是没有成功.我该怎么办?谢谢.
我写了一个注册表单,我使用的passport-local是工作,但我想添加express-validator以验证我的表单数据.我在路由器上添加验证,这是我的router/index.js代码:
/* Handle Registration POST */
router.post('/signup', function(req, res) {
req.assert('email', 'A valid email is required').isEmail();
var errors = req.validationErrors();
if(errors){ //No errors were found. Passed Validation!
res.render('register', {
message: 'Mail type fault',
errors: errors
});
}
else
{
passport.authenticate('signup', {
successRedirect: '/home',
failureRedirect: '/signup',
failureFlash : true
});
}
});
Run Code Online (Sandbox Code Playgroud)
验证是有效的,但如果成功,那么网页将加载很长时间而没有响应.我已经搜索了护照文档,但不知道要修复它.
这是原始代码,它的工作原理
/* Handle Registration POST */
router.post('/signup', passport.authenticate('signup', {
successRedirect: '/home',
failureRedirect: '/signup',
failureFlash : true
}));
Run Code Online (Sandbox Code Playgroud)
我想我可以使用jquery来检查,但我不这样做.因为我只想尝试使用带护照的验证器.
我使用了vue 2。我有来自ajax的数据,这是我的代码示例:
<template>
<div>
<input type="input" class="form-control" v-model="siteInfo.siteId">
<input type="input" class="form-control" v-model="siteInfo.info.name">
<input type="input" class="form-control" v-model="siteInfo.accountData.name">
</div>
</template>
<script>
export default {
name: 'Site',
data() {
return {
siteInfo: {},
/* siteInfoName: '', */
}
},
/*computed: {
siteInfoName: function() {
return siteInfo.info.name || '';
},
...
},*/
methods: {
getData() {
// do ajax get data
this.$http.post('URL', {POSTDATA}).then(response => {
/*
response example
{ body:
data: {
sitdeId: 1,
info: { name: 'test'},
accountData: { name: 'accountTest'},
}
} …Run Code Online (Sandbox Code Playgroud) 我使用山狮,我安装了 ruby-1.9.3-p125。我使用rake new_post['test'],终端返回信息:
rake aborted!
/Users/John/octopress/Rakefile:10: syntax error, unexpected tLSHFT, expecting $end
<<<<<<< HEAD
^
Run Code Online (Sandbox Code Playgroud)
怎么解决这个问题,谢谢!
初学者在这里.我希望我的用户选择从一个选择菜单中被记住.我把那部分放下了.但现在,它没有正确验证(以前).我该如何解决?
这是我的验证代码:
<?php
$color = $_POST["color"];
if(isset($_POST["submit"])) {
if($_POST["color"] == 0) {
$errors[] = "Select a color option.";
}
Run Code Online (Sandbox Code Playgroud)
这是带有选择列表的HTML表单和用于记住选择的php:
<h3>MP5 Information</h3>
<span>Color:</span>
<select name="color"id="color">
<option value="">- Select color -</option>
<option value="sapphire"<?php echo $color == 'sapphire' ? 'selected="selected"' : ''; ?
>>Sapphire</option>
<option value="amethyst"<?php echo $color == 'amethyst' ? 'selected="selected"' : ''; ?
>>Amethyst</option>
<option value="rose"<?php echo $color == 'rose' ? 'selected="selected"' : ''; ?
>>Rose</option>
<option value="topaz"<?php echo $color == 'topaz' ? 'selected="selected"' : ''; ?
>>Topaz</option>
</select> …Run Code Online (Sandbox Code Playgroud) 我的data.txt内容是:
1 2 3 4 5 6
1 2 3 4 5 6
4 5 6 7 8 2
Run Code Online (Sandbox Code Playgroud)
我读取文件,并将值存储到二维int数组
int record[line_number][6];
int record2[line_number][8];
int test;
for(i = 0; i <line_number; i++)
{
for(j = 0; j <6; j++)
{
fscanf(fptr, "%d", &record[i][j]);
}
}
int a=0;
int b=0;
for(a=0; a<i; a++) {
for(b=0; b<6; b++) {
printf("%d,", record[a][b]);
}
printf("\n");
}
Run Code Online (Sandbox Code Playgroud)
输出就像一个内存地址,我的代码有什么问题?谢谢!
这是我的表格,我当前的网址是.../pg/members/all
<form id="simplesearch" name="simplesearch" action="<?php echo $vars['url'];?>pg/members/searchuser" method="post">
<table class="people_search" style="border:none;">
<div id="toggle_profile_type">
<input type="hidden" value="0" name="meta_data_array_search_criteria[custom_profile_type]">
<p class="skills_even1"><input type="checkbox" name="meta_data_array_search_criteria[custom_profile_type][]" value="39242" class="messageCheckbox"><span>Job Seeker</span></p>
<p class="skills_odd1"><input type="checkbox" name="meta_data_array_search_criteria[custom_profile_type][]" value="39243" class="messageCheckbox"><span>Employer</span></p>
<p class="skills_even1"><input type="checkbox" name="meta_data_array_search_criteria[custom_profile_type][]" value="39449" class="messageCheckbox"><span>college</span></p>
</div>
</table>
</form>
Run Code Online (Sandbox Code Playgroud)
在我编写的脚本中
$(document).ready(function(){
$(":checkbox").click(function(){
simplesearchsubmitform();
});
});
function simplesearchsubmitform()
{
if(document.simplesearchonsubmit && !document.simplesearch.onsubmit()) {
return;
}
document.simplesearch.submit();
}
Run Code Online (Sandbox Code Playgroud)
我提交表单然后URL更改..../pg/members/searchuser.现在我需要获取所选的checkbox值.这样我就可以将该值附加到div中,复选框将保持选中状态.
任何想法的人怎么做?我搜索了很多,但我没有找到解决方案.PLZ帮帮我们..
我有一个表格视图,当我单击一个单元格时会调用我的PixCtrl控制器。如果我检查连接工作,我将通过 获取数据$http.get,否则我将使用 sqlite。这是工作。我想要我的ion-nav-buttons是动态的。但是当我第一次点击时,这是行不通的。我必须再做一次,这将显示出来。我不知道如何解决它。我曾使用控制台观看它,每次都是正确的,我如何在第一次点击时修复它。
谢谢你的帮助。
控制器
.controller('PixCtrl', function($scope, $sce, $stateParams, SQLService, $http....) {
...
if ( ! $rootScope.noConnection) {
$http.get('http://pixnettest-lighter.c9.io/content.php?id=' + $stateParams.pixnetId)
.success(function(data, status, headers, config) {
var pix_data = {
...
html_comment_count: datas[0].comment_count,
...
};
$scope.pix_content = pix_data;
});
}
else {
// get by sqlite data
var pixnet_data = {
...
html_comment_count: content.comment_count,
...
};
$scope.pix_content = pix_data;
}
...
$scope.checkMComBtn = function(comment_count) {
var intValue = parseInt(comment_count) || 0;
console.log('intValue ' , …Run Code Online (Sandbox Code Playgroud) html ×2
javascript ×2
php ×2
validation ×2
angularjs ×1
c ×1
forms ×1
ionic ×1
ios ×1
jquery ×1
node.js ×1
objective-c ×1
passport.js ×1
rake ×1
ruby ×1
storyboard ×1
swift ×1
vue.js ×1