小编Ste*_*hen的帖子

第一个和最后一个<li>项目上的圆角

我正在尝试在我的Wordpress主题中创建一个顶级菜单,类似于http://mailchimp.com/.正如您在此菜单中看到的,当"定价"处于活动状态时,背景将变为白色.我试图在我的菜单上实现相同的效果.

菜单背景目前有圆角:

#menu-main-menu{
    margin-top:66px;
    background: #eeeeee;

    -moz-border-radius: 5px;
    border-radius: 5px;
}
Run Code Online (Sandbox Code Playgroud)

这里没有问题.

但是当'Home'(菜单中的第一项)或'Contact'(菜单中的最后一项)处于活动状态时,问题就出现了,角落不再是圆角.

显然,对于'Home',我只希望左手角落为圆形而对于"接触"我希望右手角落圆润.这就是我现在正在尝试的内容(请参阅下面的START和STOP之间的CSS),但它似乎并没有像我想要的那样绕过角落.

            body > header .nav li a {
                            background: none;
                            text-decoration: none;
                            /*font-family: TitilliumText22L005, sans-serif;*/
                            font-family: 'Open Sans', sans-serif;
                            font-size: 13px;
                            color: #000000;
                            text-shadow: none;
                            text-transform: uppercase;
                            border-right: solid 1px #000000;
                        }

                        body > header .nav li:last-child a {
                            border-right: none;                                                     
                        }

                        body > header .nav > li.current-menu-item,
                        body > header .nav > li.current-menu-ancestor {
                            background: #c4c4c4;
                        }


        /* START: Its this bit below I'm …
Run Code Online (Sandbox Code Playgroud)

css

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

sqlite3_open - 无法打开数据库?

我的代码中有以下声明:

if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) 
Run Code Online (Sandbox Code Playgroud)

但它似乎没有打开我的数据库.

有任何想法吗 ?

sqlite iphone

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

NSPredicate - 未按预期工作

我有以下代码:

    NSString *mapIDx = @"98";
    NSLog(@"map id: %@", mapIDx);

    NSFetchRequest *request = [[NSFetchRequest alloc] init];

    NSEntityDescription *entity = [NSEntityDescription entityForName:@"WayPoint" inManagedObjectContext:managedObjectContext];
    [request setEntity:entity];

    //NSPredicate *predicate = [NSPredicate predicateWithFormat:@"waypoint_map_id=%@", mapIDx];
    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"waypoint_map_id==%@", mapIDx];
    [request setPredicate:predicate];

    NSError *error;
    listArray = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy];
    [request release];


    int arrayItemQuantity = [listArray count];
    NSLog(@"Array Quantity: %d", arrayItemQuantity);

    // Loop through the array and display the contents.
    int i;
    for (i = 0; i < arrayItemQuantity; i++)
    {
        NSLog (@"Element %i = …
Run Code Online (Sandbox Code Playgroud)

iphone core-data

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

UIImageView - 显示目录中的图像

我有以下代码:

- (void)viewDidLoad {
    NSString *homeDirectoryPath = NSHomeDirectory();
    NSString *imagePath = [homeDirectoryPath stringByAppendingString:@"/graph.png"];
    NSLog(@"Image: %@", imagePath);

    if (![[NSFileManager defaultManager] fileExistsAtPath:imagePath isDirectory:NULL]) 
    {
        graph = imagePath;
        //[[NSFileManager defaultManager] createDirectoryAtPath:imagePath attributes:nil];
    }
Run Code Online (Sandbox Code Playgroud)

'graph'被定义为UIImageView.我正在尝试在路径'imagePath'中显示该文件.我知道代码graph = imagePath不正确,因为变量'imagePath'表明它包含图像的路径.

如何在特定图像路径上显示我的图像?

问候,斯蒂芬

iphone xcode uiimageview

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

无法将TimeInterval与Integer进行比较

我正在尝试将timeInterval与整数值进行比较,因此我尝试将timeInterval转换为整数并进行比较.但是我收到错误'无法转换为指针类型':

NSTimeInterval timeInterval = [startTime timeIntervalSinceNow];
int intSecondsElapsed = [timeInterval intValue]; // Error here !!!!

if ([counterInt != intSecondsElapsed])
{
    // Do something here...
}
Run Code Online (Sandbox Code Playgroud)

怎么会这样做?

编辑:包括与执行错误相关的更多详细信息.

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    //[formatter setDateFormat:@"HH:mm:ss"];
    [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    startTime = [NSDate date];
    [formatter release];


if ([deviceType isEqualToString:@"iPhone 4"]||[deviceType isEqualToString:@"iPhone Simulator"])
    {
        int intSecondsElapsed = (int)[startTime timeIntervalSinceNow];
        if (counterInt != intSecondsElapsed)
        {
            counterInt = intSecondsElapsed;
        }
    }
Run Code Online (Sandbox Code Playgroud)

iphone nstimeinterval

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

将额外属性附加到JSON对象

我正在尝试将一个元素附加到我的JSON对象.JSON的结构如下:

    [
        {
            "newId": "167249-20",
            "title": "El Supremo ordena reabrir la causa por los delitos fiscales de Carlos Fabra",
            "created": "2011-12-01T13:22:00+01:00",
            "priority": "99999",
            "primaryCategoryId": "305",
            "summary": "La sala de lo penal de este órgano ha dejado sin efecto el archivo por prescripción de cuatro de los cinco delitos fiscales que se le imputan al expresidente de la Diputación de Castellón.",
            "image": "http%3A%2F%2Fwww.heraldo.es%2Fuploads%2Fimagenes%2Frec15%2F_reaperuradelcasofabra9558214_d07227b1.jpg",
            "timestamp": "1322742120"
        },
        {
            "newId": "167233-20",
            "title": "Victoria Rodríguez y Claire Morel se imponen en el Open de …
Run Code Online (Sandbox Code Playgroud)

javascript json

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

如何确认HTTP POST调用我的代码?

我正在尝试从POST方法中检索数据,代码如下:

-(void)postXMLFeed:(NSString *)XMLStrPost
{   
    //NSLog (@"XML Feed3: ", XMLStrPost);

    NSURL *url = [NSURL URLWithString:@"http://xxx.xxx.x.xxx/stephen/sync_upload.php"];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
    [request setValue:@"text/xml" forHTTPHeaderField:@"Content-type"];
    [request setHTTPMethod:@"POST"];
    [request setHTTPBody:[XMLStrPost dataUsingEncoding:NSASCIIStringEncoding]];

    NSURLResponse *response;
    NSError *error;
    response = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];


    // Update log file.
    NSLog(@"XML feed POSTED to website.");

    //[super postXMLFeed];
}
Run Code Online (Sandbox Code Playgroud)

我的XML Feed存储在变量中XMLStrPost.上面的代码似乎有效,但我无法确认它.

脚本应该解压缩字符串并将其写入数据库,但这似乎不会发生.在解组之前,我想确认正在调用脚本.

如何确认sync_upload.php脚本被调用?

iphone xcode http objective-c

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

弹出UIPicker而不是键盘

我想在单击文本字段时弹出UIPicker而不是键盘.这是可能的,我一直谷歌搜索一段时间,但找不到任何东西.

有没有人有任何示例代码?

问候,斯蒂芬

iphone xcode uipicker

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

CakePHP:重定向不工作

我的控制器中有以下代码:

class ContactsController extends AppController {
    public $helpers = array('Html', 'Form', 'Session');
    public $components = array('Session');

    public function index() {
        $this->set('contacts', $this->Contact->find('all'));
    }

    public function view($id) {
        if (!$id) {
            throw new NotFoundException(__('Invalid contact'));
        }

        $contact = $this->Contact->findById($id);
        if (!$contact) {
            throw new NotFoundException(__('Invalid contact'));
        }
        $this->set('contact', $contact);
    }

    public function add() {                 
        if ($this->request->is('post')) {
            $this->Contact->create();
            if ($this->Contact->save($this->request->data)) {
                $this->Session->setFlash('Your contact has been saved.');
                $this->redirect(array('action' => 'index'));
            } else {
                $this->Session->setFlash('Unable to add your contact.');
            }
        }
    }
} …
Run Code Online (Sandbox Code Playgroud)

cakephp

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

NSTimer - 秒表

我试图用HH创建一个秒表:MM:SS,代码如下:

-(IBAction)startTimerButton;
{
    myTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(showActivity) userInfo:nil repeats:YES];
}


-(IBAction)stopTimerButton;
{
    [myTimer invalidate];
    myTimer = nil;
}


-(void)showActivity;
{
    int currentTime = [time.text intValue];
    int newTime = currentTime + 1;
    time.text = [NSString stringWithFormat:@"%.2i:%.2i:%.2i", newTime];
}
Run Code Online (Sandbox Code Playgroud)

虽然输出确实按预期增加1秒,但输出的格式为XX:YY:ZZZZZZZZ,其中XX是秒.

任何人的想法?

iphone xcode

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