小编Bal*_*yal的帖子

tableviewcell内部的视图高度与ios 7和ios 8不同

我有一个uiview里面的tableviewcell.当我用ios 8运行代码时,表格cell看起来很好并且工作正常.但是,当我尝试在ios 7中运行此代码时,表cell内容重叠在其他内容上cell.

任何人都可以帮我正确地做到这一点.

附上Tableviewcell scrrenshot如下:

查看彼此重叠的内容

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{

if(!self.customCell){
    self.customCell = [self.goalDetailsTableview dequeueReusableCellWithIdentifier:@"GoalDetailsCell"];
}

//Height of cell
float height = 360;
return height;
}
Run Code Online (Sandbox Code Playgroud)

提前致谢.

objective-c uitableview ios

8
推荐指数
1
解决办法
100
查看次数

属性字符串前景色在 Swift 中不起作用

我使用下面的代码来改变foreground colorfont使用属性字符串Swift。但是字体完美地改变没有任何问题,但foreground color没有改变

var checklistText = NSMutableAttributedString()
        checklistText = NSMutableAttributedString(string: "\(lblChecklistName.text!),\(checklistName)")
        checklistText.addAttribute(NSFontAttributeName,
                                   value: UIFont(
                                    name: "Helvetica",
                                    size: 11.0)!,
                                   range: NSRange(location: lblChecklistName.text!.length(), length: checklistName.length()))
        checklistText.addAttribute(NSForegroundColorAttributeName, value: UIColor.redColor(), range: NSRange(location: lblChecklistName.text!.length(), length: checklistName.length()+1))
        lblChecklistName.attributedText = checklistText
Run Code Online (Sandbox Code Playgroud)

ios nsmutableattributedstring swift

7
推荐指数
3
解决办法
5479
查看次数

如何使用c#在asp.net网页中显示C程序错误

我正在创建在线编译器应用程序.我已成功使用C#.net和VB.net创建.但是当我尝试使用C和C++时,我不知道如何在asp.net网页中显示错误.

以下仅显示错误,但不显示代码中错误的位置

Process proc = new Process();
proc.StartInfo.FileName = Session[batchPath].ToString();
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.UseShellExecute = false;
proc.Start();
Run Code Online (Sandbox Code Playgroud)

是对还是我应该做任何修改?提前致谢.

c c# c++ asp.net compiler-construction

6
推荐指数
1
解决办法
286
查看次数

无法通过c#.net下载exe文件

我设计了一个网站,当我点击一个按钮时,.EXE文件应该从我的计算机的特定路径下载.

但它不下载exe文件而不是下载网站的aspx页面.

我使用以下代码:

WebClient myWebClient = new WebClient();
// Concatenate the domain with the Web resource filename.
myWebClient.DownloadFile("http://localhost:1181/Compile/compilers/sample2.exe", "sample2.exe");
Run Code Online (Sandbox Code Playgroud)

c# asp.net exe download

5
推荐指数
1
解决办法
2692
查看次数

[UINavigationController setGoalName:]:无法识别的选择器发送到实例0x7964e2c0

我用以下代码创建了应用程序.它与iOS7配合使用,但是当我使用iOS8运行时它会抛出以下错误.

[UINavigationController setGoalName:]: unrecognized selector sent to instance 0x7964e2c0
Run Code Online (Sandbox Code Playgroud)

我的firstViewcontroller.m

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{

GoalDetailsViewController *goalsDetailsViewController = segue.destinationViewController;
NSLog(@"%@",[NSString stringWithFormat:@"%@", [[self.arrCategoryTitle objectAtIndex:indexPath.row] objectAtIndex:indexOfCategory]]);
goalsDetailsViewController.goalName = @"Exercise Daily";

}
Run Code Online (Sandbox Code Playgroud)

我的GoalDetailsViewController.h

@interface GoalDetailsViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>

@property (nonatomic) NSString *goalName;
Run Code Online (Sandbox Code Playgroud)

提前致谢.

iphone ios7 ios8

5
推荐指数
1
解决办法
2168
查看次数

如何在iOS中以编程方式添加水平间距和垂直间距?

我在ios 8中创建了一个应用程序。由于我有4个垂直可用的标签(它应在某些条件下更改位置),因此我已禁用自动布局并以编程方式设置了约束。现在,问题是我可以为水平和垂直位置,宽度和高度设置约束,我找不到任何方法为标签之间的水平和垂直间距添加约束。

谁能帮我做到这一点。

到目前为止,我有以下代码:

NSArray *constraint_V_WebUrl = [NSLayoutConstraint constraintsWithVisualFormat:@"V:[weburl(31)]" options:0 metrics:nil views:contentDictionary];
    NSArray *constraint_H_WebUrl = [NSLayoutConstraint constraintsWithVisualFormat:@"H:[weburl(196)]" options:0 metrics:nil views:contentDictionary];
    NSArray *constraint_POS_H_WebUrl = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-13-[weburl]" options:0 metrics:nil views:contentDictionary];
[self.cardDetails addConstraints:constraint_POS_V_WebUrl];
    [self.cardDetails addConstraints:constraint_POS_H_WebUrl];
[self.cardDetails addConstraint:[NSLayoutConstraint constraintWithItem:self.weburl attribute:NSla relatedBy:NSLayoutRelationEqual toItem:self.cardDetails attribute:NSLayoutAttributeTopMargin multiplier:1 constant:0.0]];
Run Code Online (Sandbox Code Playgroud)

上面的代码工作正常。但是我想在标签之间设置水平和垂直间距。

iphone objective-c ios

4
推荐指数
2
解决办法
9432
查看次数

无法从 File.Exists() 的方法组中选择方法

我收到错误“无法从方法组中选择方法。您是否打算调用该方法”。

if ((!File.Exists(pathString + "\\" + fileName + ".cs")) &&
                (!File.Exists(pathString + "\\" + fileName + ".vb")) &&
                (!File.Exists(pathString + "\\" + fileName + ".c")) &&
                (!File.Exists(pathString + "\\" + fileName + ".cpp")))
Run Code Online (Sandbox Code Playgroud)

c#

3
推荐指数
1
解决办法
4136
查看次数

JSONDecoder 总是返回“没有与键 CodingKeys 关联的值”

我使用以下解码结构来解码来自服务器的数据,但它总是返回“没有与密钥 CodingKeys 关联的值”。请看下面的代码

struct UserDecode: Codable {

var user: User?
var result: String?

private enum CodingKeys: String, CodingKey {
    case user = "Records"
    case result = "Result"
}

init(from decoder: Decoder) throws {
    do {
        let values = try decoder.container(keyedBy: CodingKeys.self)
        result = try values.decode(String.self, forKey: .result)
        user = try values.decode(User.self, forKey: .user)
    } catch {
        print(error.localizedDescription)
    }
}
}

struct User: Codable {

var mobile: Int?
var userId: Int?
var name: String?

private enum CodingKeys: String, CodingKey {
    case …
Run Code Online (Sandbox Code Playgroud)

ios swift jsondecoder

3
推荐指数
1
解决办法
5046
查看次数

以编程方式添加的按钮在 ios 中不显示触摸感

我已经在 IOS 应用程序的 UIView 中添加了 UIButton。它与目标操作配合得很好,但是当我按下按钮时,它没有在屏幕上显示按下的感觉。(当用户触摸普通按钮时,其标题将变暗)。

我使用了以下代码:

class CustomButton: UIButton {

    override init(frame: CGRect) {
        super.init(frame: frame)
        setupViewLayouts()
    }

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        setupViewLayouts()
    }

    func setupViewLayouts() {

        titleLabel?.font = UIFont.boldSystemFont(ofSize: 16.0)

        backgroundColor = .black
        layer.borderWidth = 1.0
        layer.cornerRadius = 3.0
        layer.borderColor = UIColor.clear.cgColor

        setTitleColor(UIColor.black, for: .normal)
    }
}

var btnLogin: CustomButton = {

        let button = CustomButton()
        button.setTitle("Login", for: .normal)
        button.addTarget(self, action: #selector(btnLogin_Tapped), for: .touchUpInside)
        return button
    }()

addSubview(btnSignIn)
Run Code Online (Sandbox Code Playgroud)

uibutton uiviewcontroller uiview ios swift

1
推荐指数
1
解决办法
662
查看次数

iOS 9 UIImagePickerController 视频模式模糊

我正在使用 anUIImagePickerController来捕获视频并存储它。当我尝试使用静态图像捕获时一切正常,但是当我UIImagePickerController在视频模式下打开时,图片总是有点模糊。当我尝试聚焦不同的对象时,我看到焦点发生了变化,但它仍然有点模糊(因此从未真正聚焦)。这是一个已知问题iOS 9吗?我还尝试了一些来自互联网的示例项目,但结果相同。我用我的iPhone 6s和一个iPhone 6.

这是我使用的代码:

    func actionSheet(sheet: ActionSheet, didSelectOption option: Int) {

    let picker = UIImagePickerController()
    picker.delegate = self
    picker.navigationBar.tintColor = UIColor.whiteColor()

    let statusView = UIView(frame: UIApplication.sharedApplication().statusBarFrame)
    statusView.y = (-(UIApplication.sharedApplication().statusBarFrame.height))
    statusView.backgroundColor = colorBlue
    picker.navigationBar.insertSubview(statusView, atIndex: 1)


    if sheet.tag == actionSheetTagTakePicture {
        picker.allowsEditing = true
        picker.sourceType = option == 1 ? .Camera : .PhotoLibrary
        if option == 1 {
            picker.cameraDevice = .Front
        }
    }
    else {
        picker.mediaTypes = [kUTTypeMovie as …
Run Code Online (Sandbox Code Playgroud)

video camera uiimagepickercontroller ios ios9

0
推荐指数
1
解决办法
701
查看次数