小编ish*_*hhh的帖子

如何在UIDatePicker iphone中只显示时间

在我的应用程序中,我UIDateTimePicker通过代码显示操作表.它工作正常.但我不想显示日期和日期.如何做到这一点.请帮忙.提前致谢.

码:

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"Select     Date",@"Selecte Date")delegate:self cancelButtonTitle:NSLocalizedString(@"Done",@"Done")
destructiveButtonTitle:NSLocalizedString(@"Cancel",@"Cancel")
otherButtonTitles:nil];  


    actionSheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
  UIDatePicker  *datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 50, 320, 270)];
    //datePicker.showsSelectionIndicator = YES;
//   datePicker.dataSource = self;
//datePicker.delegate = self;
    [actionSheet addSubview:datePicker];
    [datePicker release];

    [actionSheet showInView:self.view];
    [actionSheet setBounds:CGRectMake(0, 0, 320, 500)];
  [actionSheet release];
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uiactionsheet

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

如何在android中设置背景图片

我是这个Android开发的新手.我刚刚开始创建一个hello world应用程序.

我试图设置一个背景图像,它工作正常.当我试图在图像上添加文本时,它无法正常工作.

我尝试了下面的方式.任何人都可以帮助我,我出错了.

main.xml中

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" 
    android:background="@drawable/andriod" 
    android:layout_gravity="center_vertical" 
    android:gravity="center_vertical"> 

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

HelloActivity.java

  import android.app.Activity;
  import android.os.Bundle;
  import android.widget.TextView;
  //import android.widget.ImageView;    

    public class HelloActivity extends Activity {
    //    /** Called when the activity is first created. */
    //    @Override
    //    public void onCreate(Bundle savedInstanceState) {
    //        super.onCreate(savedInstanceState);
    //        setContentView(R.layout.main);
    //    }    

    /** Called when the activity is first created. */
       @Override

       public void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);

           TextView tv …
Run Code Online (Sandbox Code Playgroud)

android

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

相机图像正在iphone中自动更改方向

我开发了一个照片应用程序

在这里,我使用来自照片库的图像以及通过相机拍摄并在图像视图中显示的图像.

来自照片库的图像的方向正确,但相机图像以不同的方向显示.

  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
    NSString *documentsDirectory = [paths objectAtIndex:0]; // Get documents folder
    NSString *dataPath = [documentsDirectory stringByAppendingPathComponent:@"MyFolder"];
    NSString *imagePath = [dataPath stringByAppendingPathComponent:@"girl.jpg"];

    if ([[NSFileManager defaultManager] fileExistsAtPath:imagePath]) {
        UIImage *image = [UIImage imageWithCGImage:[UIImage imageWithContentsOfFile:imagePath].CGImage scale:bieberImage.image.scale
                                       orientation:NO]; 

     //   bieberImage.transform = CGAffineTransformMakeRotation(1.57079633);


    CABasicAnimation *crossFade = [CABasicAnimation animationWithKeyPath:@"contents"];
    crossFade.duration = 3.0;


        crossFade.fromValue = (id)bieberImage.image.CGImage;

        crossFade.toValue = (id)image.CGImage;



        [self.bieberImage.layer addAnimation:crossFade forKey:@"animateContents"];

        }
Run Code Online (Sandbox Code Playgroud)

任何人都可以告诉我如何纠正这个问题.

提前致谢.

iphone objective-c

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

将选取器视图AM/PM更改为中文

在我的应用程序中,我使用时间选择器来设置时间.它工作正常.但是当我将区域格式更改为中文时,选择器视图正在改变但是我不能滚动分钟栏.如何解决这个问题.请帮忙.在此输入图像描述

iphone objective-c

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

本地通知不在iphone中触发

我在使用动作表选择器视图.它工作正常.但是我想local notification在特定的时间开始时time picker发射,它不会发射local notification.我用过这段代码:

enter code here

      - (void)actionPickerDone {

       if (nil != self.data) {
//send data picker message[self.target performSelector:self.action     withObject:[NSNumbernumberWithInt:self.selectedIndex]];
        }
else {
    //send date picker message
    NSCalendar *calendar = [NSCalendar autoupdatingCurrentCalendar];

    // Get the current date
    NSDate *pickerDate = [self.datePicker date];
    // Break the date up into components
    NSDateComponents *dateComponents = [calendar components:( NSYearCalendarUnit | NSMonthCalendarUnit |  NSDayCalendarUnit ) 
                                                   fromDate:pickerDate];
    NSDateComponents *timeComponents = [calendar components:( NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit ) 
                                                   fromDate:pickerDate]; …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uilocalnotification

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