Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

SCC2017「両利きスマホアプリ開発のススメ」資料

1,621 views

Published on

サッポロクリエイティブキャンプ 2017
第6回セミナー「両利きスマホアプリ開発のススメ」資料

Published in: Software
  • Be the first to comment

  • Be the first to like this

SCC2017「両利きスマホアプリ開発のススメ」資料

  1. 1. 1 3 51A8C5 31 ( - f l z g ) (. . )0
  2. 2. ) (. . )0 p y ” w os rtp) (. . )0 fl n ofi WBE 4 R_]WR y m flfi WBE 4 R_]WR z fl yfl y n fi fi fi n 4 R_]WR p OcO Vaa 1 UWaVbP ][ YW_]_b E66) (.NO R_]WRNXOcO 4 R_]WR p>]a W Vaa 1 UWaVbP ][ YW_]_b E66) (.NO R_]WRNY]a W WBE pBPXS aWcS 6 Vaa 1 UWaVbP ][ YW_]_b E66) (.NW] N]PX WBE pEdWTa Vaa 1 UWaVbP ][ YW_]_b E66) (.NW] N dWTa E4CCBDB 6D84F H8 64@C ) (. (
  3. 3. ) (. . )0 z c flu zn o fi n fl z np 4 R_]WR fi fi nWBE fi n yuiv fi y fi y n 1SIVT I0 4 R_]WR EabRW] HS_ W] 1 ) p>]a W 0lJ ]RS / p6] ]OC]R E4CCBDB 6D84F H8 64@C ) (. )
  4. 4. ) (. . )0 1SIVT I d9 e JU z zn fi n (" 4 R_]WR EabRW] n )" IS ][S a] 4 R_]WR EabRW] fi hEaO_a O Sd 4 R_]WR EabRW] C_]XS ak n " ASd C_]XS a fi 4 W OaW] O[S 6][ O f R][OW C_]XS a ] OaW] n L ASea M " FO_USa 4 R_]WR 7ScW S fi fi n L ASea M ," 4RR O 4 aWcWaf a] @]PW S fi 8[ af 4 aWcWaf n L ASea M -" 6b a][WgS aVS 4 aWcWaf fi fi n L 9W W V M E4CCBDB 6D84F H8 64@C ) (.
  5. 5. ) (. . )0 JU ( z ( H ER S R z o n pO aWcWafN[OW e[ o z n o o n W C J W aHWSd n W aHWSd fi v “ yn z fi n 7 W aHWSd E4CCBDB 6D84F H8 64@C ) (.
  6. 6. ) (. . )0 ( ( HJ ER S R z x n o S N[OW e[ z o z n fi n o o n SJ V T MTV TS R LJC J Of]baNdWRaV / R ]_WS aOaW] V]_Wg] aO 7 W[OUSHWSd Of]baNdWRaV / R Of]baNVSWUVa / R E4CCBDB 6D84F H8 64@C ) (. ,
  7. 7. ) (. . )0 SJ V T JV H J C J J C J ( Of]baNdSWUVa ]_WS aOaW] cS_aW O 7 aSeaHWSd( aSeaEWgS ) aSea6] ]_ P O Y 7 aSeaHWSd) aSeaEWgS ) aSea6] ]_ RO_YS_NU_Of E4CCBDB 6D84F H8 64@C ) (. -
  8. 8. ) (. . )0 JU) z ) c z o aS[ @OW 4 aWcWaf o fl n ) ( c z o n class Item { String BASE_URL = "https://kiroru-inc.jp/share/scc2017/"; String imageUrl; String jname; String ename; public Item(String imageUrl, String jname, String ename) { this.imageUrl = BASE_URL + imageUrl; this.jname = jname; this.ename = ename; } } private List<Item> items = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); items.add(new Item("Japan.png", "日本", "Japan")); items.add(new Item("China.png", "中国", "China")); items.add(new Item("USA.png", "アメリカ", "America")); items.add(new Item("England.png", "イギリス", "England")); items.add(new Item("France.png", "フランス", "France")); : } E4CCBDB 6D84F H8 64@C ) (. .
  9. 9. ) (. . )0 ) ) c z o @f4RO aS_ @OW 4 aWcWaf o fl n ) C J 7T IJV z @f4RO aS_ o fl HWSd ] RS_ nHWSd ] RS_ o 4 R_]WR fi nHWSd ] RS_ o n class MyAdapter extends BaseAdapter { @Override public int getCount() { return items.size(); } @Override public Object getItem(int position) { return items.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { return null; } } class ViewHolder { ImageView iv; TextView tv1; TextView tv2; } E4CCBDB 6D84F H8 64@C ) (. /
  10. 10. ) (. . )0 ) T 8S_ JV z Of]ba jOaS_ n HWSd ] RS_ n ) z o USaHWSd np n private ViewHolder holder; private LayoutInflater inflater; public MyAdapter(Context context) { super(); inflater = ((Activity)context).getLayoutInflater(); } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = inflater.inflate(R.layout.cell_main, null); holder = new ViewHolder(); holder.iv = (ImageView)convertView.findViewById(R.id.imageView); holder.tv1 = (TextView)convertView.findViewById(R.id.textView1); holder.tv2 = (TextView)convertView.findViewById(R.id.textView2); convertView.setTag(holder); } else { holder = (ViewHolder)convertView.getTag(); } Item item = items.get(position); holder.tv1.setText(item.jname); holder.tv2.setText(item.ename); return convertView;
 } E4CCBDB 6D84F H8 64@C ) (. 0
  11. 11. ) (. . )0 ) - 6 IJ z z p: WRS Vaa 1 UWaVbP ][ Pb[ aS V U WRS nPbW R U_OR S @]Rb S1 O " m Ef A]d n ) . z : WRS m o fi o m [OUSHWSd n ) / x cz m fl o n repositories { mavenCentral() // jcenter() works as well because it pulls from Maven Central } dependencies { compile 'com.github.bumptech.glide:glide:4.0.0-RC1' compile 'com.android.support:support-v4:25.3.1' annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC1' } Item item = items.get(position); Glide.with(MainActivity.this).load(item.imageUrl).into(holder.iv); holder.tv1.setText(item.jname); holder.tv2.setText(item.ename); @Override protected void onCreate(Bundle savedInstanceState) { : ListView lv = (ListView)findViewById(R.id.listView); lv.setAdapter(new MyAdapter(this)); } E4CCBDB 6D84F H8 64@C ) (. (
  12. 12. ) (. . )0 JU 1SIVT I S KJW R z AF8DA8F o zn JU a xm fifi fi n z fi n <?xml version="1.0" encoding="utf-8"?> : <uses-permission android:name="android.permission.INTERNET"/> <application android:allowBackup="true" : E4CCBDB 6D84F H8 64@C ) (. ((
  13. 13. ) (. . )0 d GOJH J 3 e JU z zn fi n (" J ]RS n )" IS ][S a] J ]RS fi h6_SOaS O Sd J ]RSk n " 6V]] S O aS[ OaS T]_ f]b_ Sd _]XS a1 fi EW U S HWSd 4 W OaW] n L ASea M " 6V]] S ] aW] T]_ f]b_ Sd _]XS a1 fi C_]Rb a AO[S m O UbOUS BPXS aWcS 6 n L ASea M ," fi n L 6_SOaS M E4CCBDB 6D84F H8 64@C ) (. ()
  14. 14. ) (. . )0 JU ( c c cflz ( C J 3TS VT JV z o o o p@OW a]_fP]O_R fi HWSd6] a_] S_ n z o p z nHWSd6] a_] S_ z n E4CCBDB 6D84F H8 64@C ) (. (
  15. 15. ) (. . )0 B8A G JC J z n B8A G JC J 3J D]d SWUVa / RS aWiS_ @f6S E4CCBDB 6D84F H8 64@C ) (. (
  16. 16. ) (. . )0 B88R LJC J z n J K IWRaV / FOU ( 6] aS a @]RS 4 S a 9Wa E4CCBDB 6D84F H8 64@C ) (. (,
  17. 17. ) (. . )0 B8 GJ z n d GJ GJ (e J / K SWUVa FOU ) 9] a Ef aS[ ) 6] ]_ 5 O Y WUVa :_Of 6] ]_ E4CCBDB 6D84F H8 64@C ) (. (-
  18. 18. ) (. . )0 JU) z ) c z o aS[ n aS[ HWSd6] a_] S_ [ n @interface Item : NSObject @property (nonatomic, strong) NSString* imageUrl; @property (nonatomic, strong) NSString* jname; @property (nonatomic, strong) NSString* ename; - (instancetype)initWithImageUrl:(NSString*)imageUrl jname:(NSString*)jname ename:(NSString*)ename; @end @implementation Item static NSString* BASE_URL = @"https://kiroru-inc.jp/share/scc2017/"; - (instancetype)initWithImageUrl:(NSString *)imageUrl jname:(NSString *)jname ename:(NSString *)ename { self = [super init]; if (self) { self.imageUrl = [NSString stringWithFormat:@"%@%@", BASE_URL, imageUrl]; self.jname = jname; self.ename = ename; } return self; } @end E4CCBDB 6D84F H8 64@C ) (. (.
  19. 19. ) (. . )0 ) ( c z o n E4CCBDB 6D84F H8 64@C ) (. (/ @interface ViewController () @property (nonatomic, strong) NSMutableArray* items; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; _items = [@[] mutableCopy]; [_items addObject:[[Item alloc] initWithImageUrl:@"Japan.png" jname:@"日本" ename:@"Japan"]]; [_items addObject:[[Item alloc] initWithImageUrl:@"China.png" jname:@"中国" ename:@"China"]]; [_items addObject:[[Item alloc] initWithImageUrl:@"USA.png" jname:@"アメリカ" ename:@"America"]]; [_items addObject:[[Item alloc] initWithImageUrl:@"England.png" jname:@"イギリス" ename:@"England"]]; [_items addObject:[[Item alloc] initWithImageUrl:@"France.png" jname:@"フランス" ename:@"France"]]; }
  20. 20. ) (. . )0 ) ) z G FOP SHWSd G FOP SHWSd7OaOE]b_ S G FOP SHWSd7S SUOaS n @interface ViewController () <UITableViewDataSource, UITableViewDelegate>   : @property (nonatomic, weak) IBOutlet UITableView* tableView; @end   : - (void)viewDidLoad { [super viewDidLoad];   : _tableView.dataSource = self; _tableView.delegate = self; }   : - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return _items.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { return nil; } - (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 80.0; } E4CCBDB 6D84F H8 64@C ) (. (0
  21. 21. ) (. . )0 ) G JC J z 5Bba Sa fi aOP SHWSd m@OW a]_f5]O_R fi n ) z aOP SHWSd1 S 9]_D]d4a RSeCOaV1 fi np n - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"MyCell"]; Item* item = _items[indexPath.row]; UILabel* tv1 =[cell viewWithTag:2]; tv1.text = item.jname; UILabel* tv2 =[cell viewWithTag:3]; tv2.text = item.ename; return cell; } E4CCBDB 6D84F H8 64@C ) (. )
  22. 22. ) (. . )0 ) z fl x fifi n z fi n E4CCBDB 6D84F H8 64@C ) (. )(
  23. 23. ) (. . )0 ) - 4DJG8R LJ z z pE7ISP [OUS Vaa 1 UWaVbP ][ _ E7ISP [OUS n 6] ]OC]R Vaa 1 ] ]O ]R ]_U fi np6] ]OC]R fi y n m m fi o y “ yn m n 6] ]OC]R n C]R9W S flyz n C]R9W S “ yn $ ls SCC2017_ios_objc.xcodeproj SCC2017_ios_objc $ pod init $ ls Podfile SCC2017_ios_objc.xcodeproj SCC2017_ios_objc $ vi Podfile # Uncomment the next line to define a global platform for your project # platform :ios, '9.0' target 'SCC2017_ios_objc' do # Uncomment the next line if you're using Swift or would like to use dynamic frameworks # use_frameworks! # Pods for SCC2017_ios_objc pod 'SDWebImage' # <-- この行を追加 end E4CCBDB 6D84F H8 64@C ) (. ))
  24. 24. ) (. . )0 m n m o o p E66) (.NW] N]PX e d]_Y O S n fi m o o n J ]RS m o o o n zn p - fl fi n $ pod install Analyzing dependencies Downloading dependencies Installing SDWebImage (3.7.5) Generating Pods project Integrating client project [!] Please close any current Xcode sessions and use `SCC2017_ios_objc.xcworkspace` for this project from now on. Sending stats Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed. [!] Automatically assigning platform ios with version 10.3 on target SCC2017_ios_objc because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/ podfile.html#platform`. $ ls Podfile SCC2017_ios_objc Podfile.lock SCC2017_ios_objc.xcodeproj Pods SCC2017_ios_objc.xcworkspace E4CCBDB 6D84F H8 64@C ) (. )
  25. 25. ) (. . )0 ) . z E7ISP [OUS o n #import <SDWebImage/UIImageView+WebCache.h>  : - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"MyCell"]; Item* item = _items[indexPath.row]; UIImageView* iv = [cell viewWithTag:1]; [iv sd_setImageWithURL:[NSURL URLWithString:item.imageUrl]]; UILabel* tv1 = [cell viewWithTag:2]; tv1.text = item.jname; UILabel* tv2 = [cell viewWithTag:3]; tv2.text = item.ename; return cell; } E4CCBDB 6D84F H8 64@C ) (. )
  26. 26. ) (. . )0 JU z xm fifi fi n z fi n E4CCBDB 6D84F H8 64@C ) (. ),
  27. 27. ) (. . )0 d K e JU z BPXS aWcS 6 fl fi n6V]] S ] aW] T]_ f]b_ Sd _]XS a1 fi O UbOUS BPXS aWcS 6 fi EdWTa “ yn JU ( c c cfl a BPXS aWcS 6 fl fi n E4CCBDB 6D84F H8 64@C ) (. )-
  28. 28. ) (. . )0 JU) a ) c z o aS[ HWSd6] a_] S_ o fl n ) ( c z o n class Item : NSObject { let BASE_URL = "https://kiroru-inc.jp/share/scc2017/" let imageUrl:String let jname:String let ename:String init(imageUrl:String, jname:String, ename:String) { self.imageUrl = BASE_URL + imageUrl self.jname = jname self.ename = ename } } var items:[Item] = [] override func viewDidLoad() { super.viewDidLoad() items.append( Item(imageUrl: "Japan.png", jname: "日本", ename: "Japan")) items.append( Item(imageUrl: "China.png", jname: "中国", ename: "China")) items.append( Item(imageUrl: "USA.png", jname: "アメリカ", ename: "America")) items.append( Item(imageUrl: "England.png", jname: "イギリス", ename: "England")) items.append( Item(imageUrl: "France.png", jname: "フランス", ename: "France")) } E4CCBDB 6D84F H8 64@C ) (. ).
  29. 29. ) (. . )0 ) ) z G FOP SHWSd G FOP SHWSd7OaOE]b_ S G FOP SHWSd7S SUOaS n ) G JC J z BPXS aWcS 6 fl fi n class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { : @IBOutlet var tableView:UITableView? = nil override func viewDidLoad() { super.viewDidLoad() tableView?.dataSource = self tableView?.delegate = self } : func numberOfSections(in tableView: UITableView) -> Int { return 1 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return items.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { return nil } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return 80.0 } E4CCBDB 6D84F H8 64@C ) (. )/
  30. 30. ) (. . )0 ) y nr z aOP SHWSd1 S 9]_D]d4a RSeCOaV1 fi n fi y fim n ) z fl x fifi n z fi np BPXS aWcS 6 fl fi n func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "MyCell")! let item = items[indexPath.row] let tv1 = cell.viewWithTag(2) as! UILabel tv1.text = item.jname let tv2 = cell.viewWithTag(3) as! UILabel tv2.text = item.ename return cell } E4CCBDB 6D84F H8 64@C ) (. )0
  31. 31. ) (. . )0 ) - 4DJG8R LJ z BPXS aWcS 6 fl fi n ) . z E7ISP [OUS o n import SDWebImage  : func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "MyCell")! let item = items[indexPath.row] let iv = cell.viewWithTag(1) as! UIImageView iv.sd_setImage(with: URL(string: item.imageUrl)!) let tv1 = cell.viewWithTag(2) as! UILabel tv1.text = item.jname let tv2 = cell.viewWithTag(3) as! UILabel tv2.text = item.ename return cell } E4CCBDB 6D84F H8 64@C ) (.
  32. 32. ) (. . )0 JU a xm fifi fi n z fi np BPXS aWcS 6 fl fi n E4CCBDB 6D84F H8 64@C ) (. (
  33. 33. ) (. . )0 1SIVT I d:T S e JU p y 4 R_]WR OcO >]a W o fl n 4 R_]WR EabRW] fi m4 R_]WR EaORW] ) fi >]a W flfi z fl fi n fi 4 R_]WR EabRW] ) fi fix fl n JU z n OcO fl fi n m fi “ yn :T S z F]] 2 >]a W 2 6] iUb_S >]a W W C_]XS a PbW R U_OR S fim Ef A]d “ yn E4CCBDB 6D84F H8 64@C ) (. )
  34. 34. ) (. . )0 ( 1H z o j OcO m>]a W n O aWcWafN[OW e[ n m>]a W m y z y z “ yn ( 9W S 2 ASd 2 >]a W 4 aWcWaf ) 8[ af 4 aWcWaf LASeaM 6b a][WgS aVS 4 aWcWaf y 4 aWcWaf AO[S @OW 4 aWcWaf nUS S_OaS Of]ba 9W S nL 9W W V M @OW 4 aWcWaf Sa6] aS aHWSd n JU ( z OcO fl fi n class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) } } E4CCBDB 6D84F H8 64@C ) (.
  35. 35. ) (. . )0 JU) z ) c z o aS[ @OW 4 aWcWaf o fl n ) ( c z o n class Item(imageUrl:String, val jname:String, val ename:String) { val imageUrl = "https://kiroru-inc.jp/share/scc2017/" + imageUrl } var items = mutableListOf<Item>() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) items.add(Item("Japan.png", "日本", "Japan")) items.add(Item("China.png", "中国", "China")) items.add(Item("USA.png", "アメリカ", "America")) items.add(Item("England.png", "イギリス", "England")) items.add(Item("France.png", "フランス", "France")) } E4CCBDB 6D84F H8 64@C ) (.
  36. 36. ) (. . )0 ) ) c a o @f4RO aS_ @OW 4 aWcWaf o fl n ) C J 7T IJV a @f4RO aS_ o fl HWSd ] RS_ n ) T 8S_ JV a Of]ba jOaS_ n HWSd ] RS_ n class MyAdapter(val context: Context, val items:MutableList<Item>) : BaseAdapter() { override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View { TODO("not implemented")
 } override fun getItem(position: Int): Any { return items[position] } override fun getItemId(position: Int): Long { return position.toLong() } override fun getCount(): Int { return items.size } } class ViewHolder(val iv: ImageView, val tv1: TextView, val tv2: TextView) {} var holder:ViewHolder? = null val inflater: LayoutInflater = (context as Activity).layoutInflater E4CCBDB 6D84F H8 64@C ) (. ,
  37. 37. ) (. . )0 ) z o USaHWSd np n ) - 6 IJ z OcO fl fi n ) . z : WRS m o fi o m [OUSHWSd n override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View { var view:View if (convertView == null) { view = inflater.inflate(R.layout.cell_main, null) holder = ViewHolder( view.findViewById(R.id.imageView) as ImageView, view.findViewById(R.id.textView1) as TextView, view.findViewById(R.id.textView2) as TextView) view.tag = holder } else { view = convertView!! holder = view.tag as ViewHolder } val item = items[position] holder?.tv1?.text = item.jname holder?.tv2?.text = item.ename return view } val item = items[position] Glide.with(context).load(item.imageUrl).into(holder?.iv) holder?.tv1?.text = item.jname holder?.tv2?.text = item.ename E4CCBDB 6D84F H8 64@C ) (. -
  38. 38. ) (. . )0 ) / x o a @f4RO aS_ fl W aHWSd n JU 1SIVT I S KJW R a OcO fl fi n JU a xm fifi fi n z fi n override fun onCreate(savedInstanceState: Bundle?) { : val lv = findViewById(R.id.listView) as ListView lv.adapter = MyAdapter(this, items) } E4CCBDB 6D84F H8 64@C ) (. .
  39. 39. ) (. . )0 z c dszhe fi zn fi n fl z np 4 R_]WR fi fi nWBE fi n E4CCBDB 6D84F H8 64@C ) (. /
  40. 40. ) (. . )0 1SIVT I d9 e JU 1H z 4 aWcWaf zn fi n (" o 9W S 2 ASd 2 4 aWcWaf 2 8[ af 4 aWcWaf n )" 6] iUb_S 4 aWcWaf fi 4 aWcWaf AO[S 7SaOW 4 aWcWaf n L9W W VM E4CCBDB 6D84F H8 64@C ) (. 0
  41. 41. ) (. . )0 JU ( z o n pO aWcWafNRSaOW e[ o z n fi n E4CCBDB 6D84F H8 64@C ) (.
  42. 42. ) (. . )0 R LJC J J C J J C J ( G TS fi z z 6] a_OW a “ yn 7 W[OUSHWSd Of]baNdWRaV (- R Of]baNVSWUVa (- R 7 aSeaHWSd( aSeaEWgS aSea6] ]_ 3O R_]WR1 ] ]_ P O Y aSea4 WU [S a 4 :AN68AF8D 7 aSeaHWSd) aSeaEWgS ) aSea6] ]_ 3O R_]WR1 ] ]_ RO_YS_NU_Of aSea4 WU [S a 4 :AN68AF8D 7 Pbaa] aSea E4CCBDB 6D84F H8 64@C ) (. (
  43. 43. ) (. . )0 JU ) z JU ) 4J 1H O z fi n @OW 4 aWcWaf aS a fi fi n m n @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_detail);
 
 Intent i = getIntent();
 String imageUrl = i.getStringExtra("imageUrl");
 String jname = i.getStringExtra("jname");
 String ename = i.getStringExtra("ename");
 
 ImageView iv = (ImageView)findViewById(R.id.imageView);
 Glide.with(this).load(imageUrl).into(iv);
 
 TextView tv1 = (TextView)findViewById(R.id.textView1);
 tv1.setText(jname);
 
 TextView tv2 = (TextView)findViewById(R.id.textView2);
 tv2.setText(ename);
 
 Button b = (Button)findViewById(R.id.button);
 b.setOnClickListener(new View.OnClickListener() {
 @Override
 public void onClick(View v) {
 finish();
 }
 });
 }
 E4CCBDB 6D84F H8 64@C ) (. )
  44. 44. ) (. . )0 JU ) ( S1H O z n aS a n JU z fi fi n fi n @Override
 protected void onCreate(Bundle savedInstanceState) {
 : 
 lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
 Item item = items.get(position);
 
 Intent i = new Intent(MainActivity.this, DetailActivity.class);
 i.putExtra("imageUrl", item.imageUrl);
 i.putExtra("jname", item.jname);
 i.putExtra("ename", item.ename);
 
 startActivity(i);
 }
 });
 }
 E4CCBDB 6D84F H8 64@C ) (.
  45. 45. ) (. . )0 1SIVT I d:T S e JU 1H z 4 aWcWaf zn fi n (" o 9W S 2 ASd 2 >]a W 4 aWcWaf n )" 4RR O 4 aWcWaf a] @]PW S fi 8[ af 4 aWcWaf nLASeaM " 6b a][WgS aVS 4 aWcWaf fi 4 aWcWaf AO[S 7SaOW 4 aWcWaf nL9W W VM JU ( z OcO fl fi n E4CCBDB 6D84F H8 64@C ) (.
  46. 46. ) (. . )0 JU ) z JU ) 4J 1H P z fi n @OW 4 aWcWaf aS a fi fi n m n JU ) ( S1H P z n aS a n JU z fi fi n fi n override fun onCreate(savedInstanceState: Bundle?) {
 super.onCreate(savedInstanceState)
 setContentView(R.layout.activity_detail)
 
 val imageUrl = intent.getStringExtra("imageUrl")
 val jname = intent.getStringExtra("jname")
 val ename = intent.getStringExtra("ename")
 
 val iv = findViewById(R.id.imageView) as ImageView
 Glide.with(this).load(imageUrl).into(iv)
 
 val tv1 = findViewById(R.id.textView1) as TextView
 tv1.text = jname
 
 val tv2 = findViewById(R.id.textView2) as TextView
 tv2.text = ename
 
 val b = findViewById(R.id.button) as Button
 b.setOnClickListener { _ -> finish() }
 }
 override fun onCreate(savedInstanceState: Bundle?) { :
 lv.setOnItemClickListener { parent, view, position, id ->
 val item = items[position]
 val i = Intent(this, DetailActivity::class.java)
 i.putExtra("imageUrl", item.imageUrl)
 i.putExtra("jname", item.jname)
 i.putExtra("ename", item.ename)
 startActivity(i)
 }
 } E4CCBDB 6D84F H8 64@C ) (. ,
  47. 47. ) (. . )0 d GOJH J 3 e JU 4J C J 3TS VT JV z 7SaOW HWSd6] a_] S_ zn fi n (" o 9W S 2 ASd 2 9W S n )" 6V]] S O aS[ OaS T]_ f]b_ Sd i S fi 6] ]O F]b V 6 O nLASeaM " 6V]] S ] aW] T]_ f]b_ Sd i S fi 6 O 7SaOW HWSd6] a_] S_ m O UbOUS BPXS aWcS 6 nLASeaM " fi nL6_SOaSM E4CCBDB 6D84F H8 64@C ) (. -
  48. 48. ) (. . )0 JU ( c c cfl a JU ( C J 3TS VT JV a o o o HWSd6] a_] S_ n mHWSd6] a_] S_ 6 O 7SaOW HWSd6] a_] S_ n VU ( ( 4J C J 3TS VT JV y c a z o z 7SaOW HWSd6] a_] S_ o n z n E4CCBDB 6D84F H8 64@C ) (. .
  49. 49. ) (. . )0 B88R LJC J B8 GJ B82 TS n J ( .l WCV] S. K , IWRaV (- SWUVa (- 6] aS a @]RS 4 S a 9Wa d GJ GJ (e J K )/ / IWRaV .,l WCV] S. SWUVa 4 WU [S a 68AF8D 9] a Ef aS[ ) 6] ]_ 5 O Y WUVa :_Of 6] ]_ J K ,,.l WCV] S. IWRaV .,l WCV] S. SWUVa FWa S E4CCBDB 6D84F H8 64@C ) (. /
  50. 50. ) (. . )0 JU ( ) JL J a HWSd6] a_] S_ p@f6S 7SaOW HWSd6] a_] S_ z ESUbS fi n ESUbS WRS aWiS_ RSaOW n o z n E4CCBDB 6D84F H8 64@C ) (. 0
  51. 51. ) (. . )0 JU ) z JU ) 4J C J 3TS VT JV z fi n fi fi n m n 4J C J 3TS VT JV M 4J C J 3TS VT JV R @interface DetailViewController : UIViewController @property (nonatomic, strong) NSString* imageUrl; @property (nonatomic, strong) NSString* jname; @property (nonatomic, strong) NSString* ename; @end #import <SDWebImage/UIImageView+WebCache.h> @interface DetailViewController () @property (nonatomic, weak) IBOutlet UIImageView* iv; @property (nonatomic, weak) IBOutlet UILabel* tv1; @property (nonatomic, weak) IBOutlet UILabel* tv2; - (IBAction)close:(id)sender; @end @implementation DetailViewController - (void)viewDidLoad { [super viewDidLoad]; [_iv sd_setImageWithURL:[NSURL URLWithString:_imageUrl]]; _tv1.text = _jname; _tv2.text = _ename; } : - (void)close:(id)sender { [self dismissViewControllerAnimated:NO completion:nil]; } E4CCBDB 6D84F H8 64@C ) (. ,
  52. 52. ) (. . )0 JU ) ( C J 3TS VT JV z n fi n C J 3TS VT JV R JU ) ) x c z 5Bba Sa fi fl o o o o n m n JU z fi fi n fi n #import "DetailViewController.h" : - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"detail"]) { Item* item = _items[_tableView.indexPathForSelectedRow.row]; DetailViewController* controller = segue.destinationViewController; controller.imageUrl = item.imageUrl; controller.jname = item.jname; controller.ename = item.ename; } } E4CCBDB 6D84F H8 64@C ) (. ,(
  53. 53. ) (. . )0 d K e JU 4J C J 3TS VT JV z BPXS aWcS 6 fl fi n6V]] S ] aW] T]_ f]b_ Sd _]XS a1 fi O UbOUS BPXS aWcS 6 fi EdWTa “ yn JU ( c c cfl a BPXS aWcS 6 fl fi n JU ) z JU ) 4J C J 3TS VT JV z fi n fi fi n m n import UIKit import SDWebImage class DetailViewController: UIViewController { var imageUrl:String? var jname:String? var ename:String? @IBOutlet var iv:UIImageView? @IBOutlet var tv1:UILabel? @IBOutlet var tv2:UILabel? override func viewDidLoad() { super.viewDidLoad() iv?.sd_setImage(with: URL(string: imageUrl!)) tv1?.text = jname tv2?.text = ename } : @IBAction func close() { self.dismiss(animated: false, completion: nil) } E4CCBDB 6D84F H8 64@C ) (. ,)
  54. 54. ) (. . )0 JU ) ( C J 3TS VT JV z n fi n C J 3TS VT JV W K JU ) ) x c z BPXS aWcS 6 fl fi n JU z fi fi n fi n m w v w ak n wotb override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "detail" { let item = items[(tableView?.indexPathForSelectedRow?.row)!] let controller = segue.destination as! DetailViewController controller.imageUrl = item.imageUrl controller.jname = item.jname controller.ename = item.ename } } E4CCBDB 6D84F H8 64@C ) (. ,

×