如何制作图库视图

时间:2013-02-02 11:57:55

标签: iphone ios6 uiimageview

  

可能重复:
  How To Create A Gallery on iOS

如何在我的应用程序中制作图像中的图库视图,任何人都可以给我一些参考吗?

enter image description here

1 个答案:

答案 0 :(得分:0)

此代码来自我们的图库中的图片路径

  protected void onActivityResult(int requestCode, int resultcode, Intent intent)
  {
  super.onActivityResult(requestCode, resultcode, intent);

  if (requestCode == 1)
  {
      if (intent != null && resultcode == RESULT_OK)
      {             

            Uri selectedImage = intent.getData();

            String[] filePathColumn = {MediaStore.Images.Media.DATA};
            Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null);
            cursor.moveToFirst();
            int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
            filePath = cursor.getString(columnIndex);
            cursor.close();
}
}
}