小编Cal*_*ter的帖子

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

循环通过UIImageViews - 目标C.

我有一些UIImageView数组,并希望循环它们来设置图像,但我不知道如何.

如果我有一个ImageView imgv,那么我这样做:

self.imgv.image =
Run Code Online (Sandbox Code Playgroud)

但是我如何在循环中使用许多UIImageViews呢?我做不到以下事情:

for(int i = 0; i < [imageViewArray count]; i++)
{
  self.i.image =
}
Run Code Online (Sandbox Code Playgroud)

loops objective-c uiimageview ios

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

本地通知声音没有播放?

我对本地通知有这个问题,他们没有播放声音.我测试了默认的一个和自定义的那个显然是我想玩但没有!我看了很多人都面临这个问题,但他们的解决方案都没有对我有用.

UILocalNotification *local

- (IBAction)Dateaction:(id)sender {

    local = [[UILocalNotification alloc]init];
    local.timeZone = [NSTimeZone defaultTimeZone];
    local.alertBody = [NSString stringWithFormat:@"%@ Recuerda que tienes que: %@", [[NSUserDefaults standardUserDefaults] objectForKey:@"user"], [[NSUserDefaults standardUserDefaults] objectForKey:@"selected"]];
    local.fireDate = [self.DatePicker date];
   /* if ([[self.userdefaults objectForKey:@"sound"]isEqualToString:@"sound1"]) {
        local.soundName = @"sound1.caf";
    }else if([[self.userdefaults objectForKey:@"sound"]isEqualToString:@"sound2"]){
        local.soundName = @"sound2.caf";
    }else if([[self.userdefaults objectForKey:@"sound"]isEqualToString:@"sound1"]){
        local.soundName = @"sound3.caf";
    }else{
        local.soundName = @"sound1.caf";
    }*/
    local.soundName = UILocalNotificationDefaultSoundName;


}

- (IBAction)switchChanged:(id)sender {
if(self.NotSwith.isOn == YES){
        [[UIApplication sharedApplication] scheduleLocalNotification:local];


       }
}
Run Code Online (Sandbox Code Playgroud)

audio objective-c ios uilocalnotification

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

多次查找数组中相同元素的索引

我想在没有方法的同一个数组中找到一个元素的POSITIONS,一个算法......

示例:

var a = [1,2,2,1,4,5,6]
to display positions of 1 : position 0 and 3
to display positions of 2 : position 1 and 2
Run Code Online (Sandbox Code Playgroud)

到目前为止我做了什么:

function count(array,element){
    while(element in array){
        return array.indexOf(element);
    }
}
Run Code Online (Sandbox Code Playgroud)

javascript arrays algorithm

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

在Amazon ec2用户中安装GoDaddy SSL

我被困在这一点上:

生成证书签名请求(CSR)-Apache 2.x

  1. 在命令提示符下输入以下内容:openssl req -new -newkey rsa:2048 -nodes -keyout yourdomain.key -out yourdomain.csr将yourdomain替​​换为要保护的域名。例如,如果您的域名为coolexample.com,则应输入coolexample.key和coolexample.csr。

我所做的是

openssl req -new -newkey rsa:2048 -nodes -keyout 180.21.80.1.key -out 180.21.80.1.csr
Run Code Online (Sandbox Code Playgroud)

我使用了t1实例的公共IP地址。我已经生成了密钥和CSR文件。

180.21.80.1。关键

180.21.80.1.csr

像这样。现在可以将其复制并粘贴到爸爸中。

我的问题是:

  • 我做的对吗?
  • 是否需要为我的IP地址创建一个名称,例如域?
  • 如果我犯错可以吗?它是可编辑的,对不对?

ssl amazon-ec2 amazon-web-services

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

使用按钮向tableview添加行

我想在上角用一个按钮制作一个tableview.我希望按钮再向表视图添加一行,以便您可以将图像添加到单元格或文本中.我在互联网上搜索但我没有找到答案.

这是源代码:

import UIKit

class TableViewController: UITableViewController {

    var imageArray = ["1","2","3","4","5","6","7"]

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

        let cell = tableView.dequeueReusableCellWithIdentifier("Reccept") as UITableViewCell!

        let imageView = cell.viewWithTag(2) as! UIImageView!
        imageView.image = UIImage(named: imageArray[indexPath.row])

        return cell

    }

    override func tableView(tableView: UITableView, numberOfRowsInSection …
Run Code Online (Sandbox Code Playgroud)

xcode swift xcode7

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

Objective-C语法错误"预期']'"

我正在尝试配置一个单元格TableView.我要做的其中一件事是更改单元格中文本的字体和颜色.这是代码:

- (void)configureView {
    UIFont *cellFont = [UIFont fontWithName:@"Raleway-Thin" size:14];
    NSDictionary *cellAttributesDictionary = [NSForegroundColorAttributeName: [UIColor whiteColor], NSFontAttributeName: cellFont];
}
Run Code Online (Sandbox Code Playgroud)

NSFontAttributeName我收到错误后在冒号Expected ']'.导致此错误的原因是什么?

objective-c uitableview ios

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

我可以创建一个从Array子类化的类吗?

我正在摆弄制作一个cocoapod,我正在努力创建一个类来自类的子类Array.

我之所以将其归为子类Array,是因为Array并且NSArray在Swift中被区别对待.

我可以创建一个这样的类:

class Test : NSArray {}
Run Code Online (Sandbox Code Playgroud)

但如果我试试这个:

class Test : Array {}
Run Code Online (Sandbox Code Playgroud)

或这个:

class Test : [AnyObject] {}
Run Code Online (Sandbox Code Playgroud)

我收到一个错误.

我想要这个的原因主要是因为我可以使用这样的函数:

let i = myArray.randomObject()
Run Code Online (Sandbox Code Playgroud)

对此:

let i = Test.randomObject(myArray)
Run Code Online (Sandbox Code Playgroud)

我能做什么的想法(相反可能)?

arrays inheritance class swift swift2

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

如何将蒸气 4 降级为蒸气 3?

我第一次下载了蒸汽,我得到了蒸汽4,不幸的是,我所有的教程都是建立在蒸汽3上的,如何降级蒸汽版本?

vapor server-side-swift

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

如何使用Java维护Iterator

我有Iterator实例.我必须得到这个的大小.在这里,我得到了条目的大小.平均大小为8.假设我想在此迭代器中仅显示5个值.我该如何实现这一个?

Document<Feed> feeddoc = resp.getDocument();
List<Entry> entries = feeddoc.getRoot().getEntries();
entries = feeddoc.getRoot().getEntries();
Iterator<Entry> iterator = entries.iterator();
int size = entries.size();  //8

while (iterator.hasNext()) {

    /* here I am getting 8 values means iterating 8 times but I want to iterate only 5 times */
    Entry next = iterator.next();
    userDetailsVos = new UserDetailsVos();
    userDetailsVos.setTitle(next.getTitle());

    final IRI temp = next.getLinkResolvedHref("alternate");
    userDetailsVos.setUrl(temp.toString());
    userDetailsVos.setTime(next.getContentElement().getFirstChild().getElements().get(5).getText());

    System.out.println("(1)--" + next.getTitle());
    System.out.println("(2)--" + next.getContentElement().getFirstChild().getElements().get(5).getText());
    System.out.println("url: " + temp.toString());
}
Run Code Online (Sandbox Code Playgroud)

java iterator list

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

Go语言程序错误

我是一名新的 Go 语言程序员。以下是我的程序,但我收到此错误:

#command-line-arguments
    .\helloworld.go:20: undefined: json.Marshall
Run Code Online (Sandbox Code Playgroud)

谁能告诉我为什么会收到错误?

package main

import (
    "encoding/json"
    "fmt"
    "net/http"
)

type API struct {
    Message string "json:message"
}

func main() {

    http.HandleFunc("/api", func(w http.ResponseWriter, r *http.Request) {

        message := API{"Hello, World!!!"}

        output, err := json.Marshall(message)

        if err != nil {
            fmt.Println("Something went wrong")
        }

        fmt.Fprintf(w, string(output))

    })

    http.ListenAndServe(":8080", nil)

}
Run Code Online (Sandbox Code Playgroud)

go

-2
推荐指数
1
解决办法
2836
查看次数

Swift 中的共享实例

有人能帮我把这段代码转换成 Swift 吗?

这里我提到了.h和.m在Objective-C 代码中。

Abc是一个UIViewController。我想在我的 Swift 代码中执行这个方法。S怎么可能?

Abc.h

+ (Abc*)sharedInstance;
- (void) startInView:(UIView *)view;
- (void) stop;
Run Code Online (Sandbox Code Playgroud)

Abc.m

static Abc*sharedInstance;

+ (Abc*)sharedInstance
{
    @synchronized(self)
    {
        if (!sharedInstance)
        {
            sharedInstance = [[Abc alloc] init];
        }

        return sharedInstance;
    }
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {

    }
    return self;
}

@end
Run Code Online (Sandbox Code Playgroud)

objective-c ios swift swift2

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