我知道这里有关于同样问题的SO有多个问题,我已经调查了它们但是并没有得到令人满意的答案.所以这是我的问题,
我有一个由几个文本框和复选框组成的表单.看起来像这样,

用户可以选择多个复选框.我正在尝试将这些复选框的值(而不是显示文本字符串)插入到MySQL表中.看起来应该是这样的,

一个服务ID(SID)可以有多个位置(Loc_Code).这些位置代码(CO,GQ)是复选框的值.
到目前为止,我已经编写了以下代码.
<html>
<head>
</head>
<body>
<?php
require_once("db_handler.php");
$conn = iniCon();
$db = selectDB($conn);
/* Generating the new ServiceID */
$query = "SELECT SID FROM taxi_services ORDER BY SID DESC LIMIT 1";
$result = mysql_query($query, $conn);
$row = mysql_fetch_array($result);
$last_id = $row["SID"];
$id_letter = substr($last_id, 0, 1);
$id_num = substr($last_id, 1) + 1;
$id_num = str_pad($id_num, 3, "0", STR_PAD_LEFT);
$new_id = $id_letter . $id_num;
//Selecting locations
$query = "SELECT Loc_Code, Name FROM districts";
$result = …Run Code Online (Sandbox Code Playgroud) 是否可以仅使用CSS创建以下内容?

我创造了容器和圆角.小提琴这里.
但我不知道如何获得轻微的闪亮效果.是否可以在CSS中执行此操作?如果是这样的话?
下面是我到目前为止编写的代码.
HTML
<div id="phone-outer">
<div id="phone-inner">
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
#phone-outer {
margin-bottom:200px;
margin:0 auto;
width:400px;
height:500px;
background-color:#333;
-webkit-border-bottom-right-radius:25px;
-webkit-border-bottom-left-radius:25px;
-moz-border-radius-bottomright:25px;
-moz-border-radius-bottomleft:25px;
border-bottom-right-radius:25px;
border-bottom-left-radius:25px;
}
#phone-inner {
margin:0 auto;
background-color:#FFF;
width:360px;
height:460px;
}
Run Code Online (Sandbox Code Playgroud) 我有一个故事板应用程序,它有一个UIViewController和一个UICollectionViewController.在视图控制器中,用户从iPhone的照片库中选择多张照片(由于iOS中没有用于多选的API,我使用了ELCImagePickerController来实现这一点).它会转移到集合视图控制器,其中所选照片应以小图像视图显示.
图像库显示,我可以选择多张照片.但当它转移到集合视图控制器时,它会抛出- [UIImage长度]:在集合视图的cellForItemAtIndexPath事件中发送到实例错误的无法识别的选择器.
下面是我到目前为止的代码.
ViewController.h
#import <UIKit/UIKit.h>
#import "ELCImagePickerController.h"
#import "ELCAlbumPickerController.h"
#import "ELCAssetTablePicker.h"
#import "GalleryViewController.h"
@interface ViewController : UIViewController
@property (strong, nonatomic) NSMutableArray *cameraImages;
- (IBAction)chooseImages:(id)sender;
@end
Run Code Online (Sandbox Code Playgroud)
ViewController.m
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (IBAction)chooseImages:(id)sender
{
UIActionSheet *photoSourcePicker = [[UIActionSheet alloc] initWithTitle:nil
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Take Photo", @"Choose from Library", nil, nil];
[photoSourcePicker showInView:self.view];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
switch (buttonIndex) { …Run Code Online (Sandbox Code Playgroud) uiimagepickercontroller uiimage nsmutablearray ios uicollectionviewcell
我有一组图像显示在UICollectionView.当用户点击图像时,它会UIActionSheet为该图像生成一些选项.其中一人正在删除照片UICollectionView.当用户选择中的删除按钮时UIActionSheet,会弹出一个要求确认的警报视图.如果用户选择是,则应删除照片.
我的问题是,要从中删除项目UICollectionView,您必须将其传递indexPath给deleteItemsAtIndexPaths事件.由于在警报视图的didDismissWithButtonIndex事件中授予了最终确认,我无法找到indexPath从那里获取所选图像的方法以将其传递给deleteItemsAtIndexPaths事件.我怎样才能做到这一点?
这是我的代码:
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
switch (buttonIndex) {
case 0:
deletePhotoConfirmAlert = [[UIAlertView alloc] initWithTitle:@"Remove Photo"
message:@"Do you want to remove this photo?"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil, nil];
[deletePhotoConfirmAlert addButtonWithTitle:@"Yes"];
[deletePhotoConfirmAlert show];
break;
case 1:
NSLog(@"To Edit photo");
break;
}
}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
if (alertView == deletePhotoConfirmAlert) {
if (buttonIndex == 1) {
// Permission …Run Code Online (Sandbox Code Playgroud) 我正在尝试UISearchControlleriOS 8中引入的新API.尽管API是新的,但它使用的是相同的旧API UISearchBar.我把它添加到UINavigationController的titleView.

import UIKit
class ViewController: UIViewController, UISearchBarDelegate {
override func viewDidLoad() {
super.viewDidLoad()
let searchController = UISearchController(searchResultsController: nil)
searchController.hidesNavigationBarDuringPresentation = false
searchController.dimsBackgroundDuringPresentation = false
searchController.searchBar.delegate = self
navigationItem.titleView = searchController.searchBar
}
}
Run Code Online (Sandbox Code Playgroud)
我不需要搜索栏来获取导航栏的整个宽度.问题是我无法调整它的大小.首先,我尝试设置搜索栏的框架.
searchController.searchBar.frame = CGRect(x: 0, y: 0, width: 100, height: 44)
Run Code Online (Sandbox Code Playgroud)
这没用,所以我试着设置titleView框架.
navigationItem.titleView!.frame = CGRect(x: 0, y: 0, width: 100, height: 44)
Run Code Online (Sandbox Code Playgroud)
它们都不起作用.
有谁知道另一种方法吗?
谢谢.
我在使用git-flow时遇到了问题.不确定这是否是预期的行为所以请为我澄清一下.
我在Bitbucket中创建一个空的repo并将其克隆到我的本地机器上.然后我在repo中创建一个Xcode项目(我做iOS开发),提交它并将其推送到Bitbucket.
然后我继续并初始化我的本地仓库以使用git flow.我顺便使用SourceTree.然后我创建了一个新的功能分支,我们称之为FirstFeature.我将一些文件添加到项目中并再次推送它.现在我的远程仓库中有3个分支:master,develop和FirstFeature.
然后我再次处理该项目并完成该功能.FirstFeature分支被删除并与本地开发合并.然后我继续把它推到Bitbucket.我认为自从FirstFeature的本地分支被删除后,当我推送新的更改时它会被删除,但显然不是.我的Bitbucket回购中仍然存在FirstFeature分支.
这是预期的行为还是我需要做一些额外的事情来取消这些行为?
谢谢.
git bitbucket branching-and-merging git-flow atlassian-sourcetree
我正在尝试跟踪网络状态.我查看了FXReachability的代码.具体如下方法.
- (void)setHost:(NSString *)host
{
if (host != _host)
{
if (_reachability)
{
SCNetworkReachabilityUnscheduleFromRunLoop(_reachability, CFRunLoopGetMain(), kCFRunLoopCommonModes);
CFRelease(_reachability);
}
_host = [host copy];
_status = FXReachabilityStatusUnknown;
_reachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, [_host UTF8String]);
SCNetworkReachabilityContext context = { 0, ( __bridge void *)self, NULL, NULL, NULL };
SCNetworkReachabilitySetCallback(_reachability, ONEReachabilityCallback, &context);
SCNetworkReachabilityScheduleWithRunLoop(_reachability, CFRunLoopGetMain(), kCFRunLoopCommonModes);
}
}
Run Code Online (Sandbox Code Playgroud)
它的作用是不断检查与指定主机的连接.我正在尝试将此方法转换为Swift,我遇到了一些问题.
1.将主机字符串转换为UTF8.
我必须将主机字符串转换为UTF8并将其传递给SCNetworkReachabilityCreateWithName方法.我无法UTF8String在Objective-C中找到Swift的确切属性.但是,有一个叫做属性utf8的String类型.根据文件,
您可以通过迭代其utf8属性来访问String的UTF-8表示.此属性的类型为String.UTF8View,它是无符号8位(UInt8)值的集合,一个用于字符串的UTF-8表示形式中的每个字节:
如何获得字符串的完整UTF8表示而不是无符号8位(UInt8)值的集合?
2. SCNetworkReachabilitySetCallback的回调函数.
此函数的第二个参数需要某种类型SCNetworkReachabilityCallBack.我潜入了源文件,发现它实际上是一个typealias.
typealias SCNetworkReachabilityCallBack = CFunctionPointer<((SCNetworkReachability!, …Run Code Online (Sandbox Code Playgroud) 我有一个叫做的课Option.这是一个Realm对象,因此它是Realm自己的基类的子类Object.
在视图控制器中,我有一个包含一堆Option对象的数组属性.
private var options = [Option]()
Run Code Online (Sandbox Code Playgroud)
在视图控制器中的方法中,我需要检查Option上述选项数组中是否包含某个对象.
以前(Swift 1.2),我有这样的检查逻辑.
func itemSelected(selection: Object) {
let option = selection as! Option
if !contains(options, option) {
// act accordingly
}
}
Run Code Online (Sandbox Code Playgroud)
现在我将项目转换为Swift 2(我已经将Realm的版本更新为Swift 2版本).我将代码更新为此.
func itemSelected(selection: Object) {
let option = selection as! Option
if !options.contains(option) {
// act accordingly
}
}
Run Code Online (Sandbox Code Playgroud)
但是现在我得到以下编译错误!
无法将'Option'类型的值转换为预期的参数类型'@noescape(Option)throws - > Bool'
我无法弄清楚为什么.有任何想法吗?
我有这样的格式化货币值.$99.99.我需要在货币符号和金额之间留一个空格$ 99.99.从这个答案我发现我需要使用填充.然而,我正在尝试的是不工作.
private var currencyFormatter: NSNumberFormatter = {
let formatter = NSNumberFormatter()
formatter.numberStyle = .CurrencyStyle
formatter.paddingPosition = .AfterPrefix
return formatter
}()
var price: Float = 99.99
let s = currencyFormatter.stringFromNumber(price)
print(s!) // I still get $99.99
Run Code Online (Sandbox Code Playgroud)
也许我错过了什么?
我试图让标注工作,但这并没有发生,因为我在准备segue时做错了.我想知道如何能够将pin注释标注到另一个视图?