묻고 답해요
158만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결탄탄한 백엔드 NestJS, 기초부터 심화까지
prettier 관련 질문드립니다.
prettier 관련 질문도 드려도 되는지 모르겠지만 일단 강의에서 나와서 질문드립니다! :) 프리티어 세팅을 하고 작업을 하다가const test = { a: "test", b: "test2", };위와 같은 코드를 써봤는데요. 이 때, 제가 원하는건 a속성과 b속성의 간격이 없는 즉, 의미없는 빈 줄이 없도록 하는 것입니다. 하지만, 이걸 prettier로 자동으로 하는 속성 값을 인터넷으로 찾아봐도(사실 검색할 단어를 잘 못찾은 것 같습니다) 없어서요.. 질문에 올립니다! 감사합니다!
-
해결됨카프카 완벽 가이드 - 커넥트(Connect) 편
스프링 연결시 오류
안녕하세요 선생님 가상머신 우분투에 올려서 터미널로 프로듀싱한 레코드를스프링에서 컨슈밍해서 보려고하는데 터미널 컨슈머에서는 정상으로 레코드를 받아오는데스프링에서는 브로커에 닿지 않는 것 같은데 혹시 서버 프로퍼티 문제일까요? 어떻게 하면 브로커에 연결이 될까요 ? package com.example; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import org.apache.kafka.clients.consumer.ConsumerConfig; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.ConsumerRecords; import org.apache.kafka.clients.consumer.KafkaConsumer; import org.apache.kafka.common.serialization.StringDeserializer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.fasterxml.jackson.databind.ObjectMapper; import java.time.Duration; import java.util.*; public class SimpleConsumer { private final static Logger logger = LoggerFactory.getLogger(SimpleConsumer.class); private final static String TOPIC_NAME = "test"; private final static String BOOTSTRAP_SERVERS = "localhost:9092"; private final static String GROUP_ID = "test-group"; public static void main(String[] args) { Properties configs = new Properties(); configs.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, BOOTSTRAP_SERVERS); configs.put(ConsumerConfig.GROUP_ID_CONFIG, GROUP_ID); configs.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()); configs.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()); KafkaConsumer<String, String> consumer = new KafkaConsumer<>(configs); consumer.subscribe(Arrays.asList(TOPIC_NAME)); while (true) { ConsumerRecords<String, String> records = consumer.poll(Duration.ofSeconds(1)); for (ConsumerRecord<String, String> record : records) { logger.info("record:{}", record); String message = record.value(); System.out.println(message); } } } 구동시 에러[main] INFO org.apache.kafka.clients.consumer.ConsumerConfig - ConsumerConfig values: allow.auto.create.topics = true auto.commit.interval.ms = 5000 auto.offset.reset = latest bootstrap.servers = [localhost:9092] check.crcs = true client.dns.lookup = default client.id = client.rack = connections.max.idle.ms = 540000 default.api.timeout.ms = 60000 enable.auto.commit = true exclude.internal.topics = true fetch.max.bytes = 52428800 fetch.max.wait.ms = 500 fetch.min.bytes = 1 group.id = test-group group.instance.id = null heartbeat.interval.ms = 3000 interceptor.classes = [] internal.leave.group.on.close = true isolation.level = read_uncommitted key.deserializer = class org.apache.kafka.common.serialization.StringDeserializer max.partition.fetch.bytes = 1048576 max.poll.interval.ms = 300000 max.poll.records = 500 metadata.max.age.ms = 300000 metric.reporters = [] metrics.num.samples = 2 metrics.recording.level = INFO metrics.sample.window.ms = 30000 partition.assignment.strategy = [class org.apache.kafka.clients.consumer.RangeAssignor] receive.buffer.bytes = 65536 reconnect.backoff.max.ms = 1000 reconnect.backoff.ms = 50 request.timeout.ms = 30000 retry.backoff.ms = 100 sasl.client.callback.handler.class = null sasl.jaas.config = null sasl.kerberos.kinit.cmd = /usr/bin/kinit sasl.kerberos.min.time.before.relogin = 60000 sasl.kerberos.service.name = null sasl.kerberos.ticket.renew.jitter = 0.05 sasl.kerberos.ticket.renew.window.factor = 0.8 sasl.login.callback.handler.class = null sasl.login.class = null sasl.login.refresh.buffer.seconds = 300 sasl.login.refresh.min.period.seconds = 60 sasl.login.refresh.window.factor = 0.8 sasl.login.refresh.window.jitter = 0.05 sasl.mechanism = GSSAPI security.protocol = PLAINTEXT security.providers = null send.buffer.bytes = 131072 session.timeout.ms = 10000 ssl.cipher.suites = null ssl.enabled.protocols = [TLSv1.2] ssl.endpoint.identification.algorithm = https ssl.key.password = null ssl.keymanager.algorithm = SunX509 ssl.keystore.location = null ssl.keystore.password = null ssl.keystore.type = JKS ssl.protocol = TLSv1.2 ssl.provider = null ssl.secure.random.implementation = null ssl.trustmanager.algorithm = PKIX ssl.truststore.location = null ssl.truststore.password = null ssl.truststore.type = JKS value.deserializer = class org.apache.kafka.common.serialization.StringDeserializer [main] INFO org.apache.kafka.common.utils.AppInfoParser - Kafka version: 2.5.0 [main] INFO org.apache.kafka.common.utils.AppInfoParser - Kafka commitId: 66563e712b0b9f84 [main] INFO org.apache.kafka.common.utils.AppInfoParser - Kafka startTimeMs: 1679530659001 [main] INFO org.apache.kafka.clients.consumer.KafkaConsumer - [Consumer clientId=consumer-test-group-1, groupId=test-group] Subscribed to topic(s): test [main] WARN org.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-test-group-1, groupId=test-group] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. [main] WARN org.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-test-group-1, groupId=test-group] Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected [main] WARN org.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-test-group-1, groupId=test-group] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. [main] WARN org.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-test-group-1, groupId=test-group] Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected [main] WARN org.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-test-group-1, groupId=test-group] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. [main] WARN org.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-test-group-1, groupId=test-group] Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected [main] WARN org.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-test-group-1, groupId=test-group] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. [main] WARN org.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-test-group-1, groupId=test-group] Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected [main] WARN org.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-test-group-1, groupId=test-group] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. [main] WARN org.apache.kafka.clients.NetworkClient - [Consumer clientId=consumer-test-group-1, groupId=test-group] Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected server properties -----------------------------------------------------++ 로컬 터미널에서는 스프링에 정상적으로 연동이 되는데가상머신에서 띄운 터미널은 로컬터미널과 같은 토픽인데도 컨슈밍을 하지 않습니다(스프링에도 가상머신에 띄운 프로듀서 레코드 전송은 안되는데 로컬 터미널 프로듀서에서 보낸 것은 받음 ) 로컬 가상머신위와 같이 동시에 각각 터미널에 같은 토픽, 부트스트랩서버로 보냈는데 각각 터미널에서만 통신이 되는 것 같습니다 public class SimpleConsumer { private final static Logger logger = LoggerFactory.getLogger(SimpleConsumer.class); private final static String TOPIC_NAME = "study"; private final static String BOOTSTRAP_SERVERS = "localhost:9092"; private final static String GROUP_ID = "test-group"; public static void main(String[] args) { Properties configs = new Properties(); configs.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, BOOTSTRAP_SERVERS); configs.put(ConsumerConfig.GROUP_ID_CONFIG, GROUP_ID); configs.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()); configs.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()); KafkaConsumer<String, String> consumer = new KafkaConsumer<>(configs); consumer.subscribe(Arrays.asList(TOPIC_NAME)); while (true) { ConsumerRecords<String, String> records = consumer.poll(Duration.ofSeconds(1)); for (ConsumerRecord<String, String> record : records) { logger.info("record:{}", record); String message = record.value(); System.out.println("message : " + message); } } } }[main] INFO com.example.SimpleConsumer - record:ConsumerRecord(topic = study, partition = 0, leaderEpoch = 0, offset = 3, CreateTime = 1679534086551, serialized key size = 1, serialized value size = 3, headers = RecordHeaders(headers = [], isReadOnly = false), key = 4, value = aaa) message : aaa [main] INFO com.example.SimpleConsumer - record:ConsumerRecord(topic = study, partition = 0, leaderEpoch = 0, offset = 4, CreateTime = 1679534345840, serialized key size = 1, serialized value size = 3, headers = RecordHeaders(headers = [], isReadOnly = false), key = 5, value = 555) message : 555 위에 터미널 프로듀서로 보낸 값만 넘어옵니다 이상입니다감사합니다.
-
미해결스프링 시큐리티 OAuth2
로그아웃관련하여 질문드립니다!
안녕하세요!제가 강의를 듣고 직접 구현을 해보고 있는 중에 궁금한 점이 있습니다. 저는 인가서버에다가 로그인 페이지를 구성해서 아이디와 비밀번호를 입력하면 동의화면이 나와서 SCOPE 를 부여한 뒤 리소스 서버에 접근하는 로직의 흐름으로 구현을 생각해보고 있습니다.로그아웃을 하고나면 인가서버를 통해서 동의 받은 SCOPE도 다 날려서 인가서버 로그인화면으로 리다이렉트 하고 싶습니다. 제 바람과는 달리 계속 이미 인가가 된 상태가 되어서 마지막 강의 예제 코드를 기반으로 연구하고 있는데 127.0.0.1:8081/home 에서 로그아웃을 하고난 뒤 127.0.0.1:8081 로 리다이렉트 되도록 했는데 로그인링크를 누르면 127.0.0.1:9000/login 으로 가는 것이 아니라 바로 127.0.0.1:8081 로 이동해서 access token 버튼이 있는 화면으로 넘어갑니다. 제가 질문드리고 싶은 것은 로그아웃을 하고나서 로그인 하면 인가서버에 구현된 로그인 화면으로 이동해서 다시 로그인해서 동의화면을 받도록 하려면 어떤식으로 로직을 구성해야 할까요?ㅠ 몇 주 고민하다가 방법을 모르겠어서 질문드립니다.
-
미해결15일간의 빅데이터 파일럿 프로젝트
너무 좋은 강의 완강하고 싶은데 연장가능할까요?
안녕하세요.빅디님의 책과 강의로 열심히 따라가고 있는데 여러 업무를 병행하다보니 강의의 반도 진행하지 못했습니다. 강의를 들으면 정말 제가 알지 못했던 분야를 너무 쉽게 알아가는 기쁨에 가슴이 뛰는데 업무에 치이면서 살다보니 어느덧 강의 만료일이 다가 왔습니다.혹시 기간 연장을 조금 더 해주실수 있다면 부탁드리겠습니다.이 강의는 꼭 완료하고 싶습니다.부탁드리겠습니다. 감사합니다.
-
미해결대세는 쿠버네티스 (초급~중급편)
Ingress 관련해서 service-loadbalancing 추가시 Ingress 목록에 나오지 않고 있습니다.
안녕하세요service-loadbalancing 추가 소스 추가시 정상적으로 추가가 되는듯 하지만Ingress 목록에는 생성되지 않고 있습니다.아래 코드를 대상으로 진행했으며 혹시 생성되지 않았나 싶어서 동일하게 아래 코드 실행시 이미 존재 한다고 나오고 있네요Deploying file has failedingresses.networking.k8s.io "service-loadbalancing" already existsOKapiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: service-loadbalancing spec: ingressClassName: nginx rules: - http: paths: - path: / backend: serviceName: svc-shopping servicePort: 8080 - path: /customer backend: serviceName: svc-customer servicePort: 8080 - path: /order backend: serviceName: svc-order servicePort: 8080
-
미해결웹게임을 만들며 배우는 인터렉티브웹! JAVASCRIPT
requestanimationframe 성능관련 궁금증
안녕하세요 좋은 강의 잘 참고해서 재밌게 만들어보고있습니다. ^^requestanimationframe을 사용해서 애니메이션이 부드럽게 잘 이동합니다만애니메이션 종료를 따로 설정해주지 않으면 renderGame()은 무한히 반복될텐데 성능에 문제가 없을까요?bulletComProp.arr와 allMonsterComProp.arr의 경우 충돌하거나 사라질때 배열에서 삭제하기때문에 순회할게 없어 동작이 안된다고하더라도 hero.keyMotion 혹은 setGameBackground는 console로 찍어보니 값이 무한히 반복해서 성능에 문제가 되지 않을까 고민해보게 되네요답변주시면 감사하겠습니다정말 감사합니다.
-
미해결자바 ORM 표준 JPA 프로그래밍 - 기본편
jpa repository.save 메서드 구현 코드를 보고 싶습니다
강사님 안녕하세요~ 회사에서jpa 사용하면서 깊이 생각 안하고 사용하다가궁금한점이 생겼습니다 특정 리포지토리가 있다고 가정하겠습니다@Repositorypublic interface 리포지토리 extends JpaRepository<도메인, Long>, JpaSpecificationExecutor<도메인> { 리포지토리.save(); 하면 스프링프레임웍 하이버네이트 구현체가 실행해준다고 하는데저는 실제 프레임웍 구현체 소스 코드를 보고 싶습니다제가 IDE 이클립스를 사용중인데 어디라이브러리나소스 코드를 보면 될까요리포지토리.save() -> █이메서드를 클릭하면org.springframework.data.repository.CrudRepository 다시 인터페이스이고 @NoRepositoryBeanpublic interface CrudRepository<T, ID> extends Repository<T, ID> {<S extends T> S save(S entity);=> █ CrudRepository 인터페이스의 save 메서드를 구현코드는또 어느라이브러리에 어떤 메서드를 확인하면 될까요? *.스프링, 스프링부트 강의 수강하며 계속 반복되는 얘기가유연하게 적용하기위해 많은 인터페이스를 사용하고구현체가 있다고 계속 얘기되는데그럼 그런 구현체를 최 하위의 클래스 메서드를 보는 방법이 어떻게 되는지 궁금하네요.. *.추가적으로 소스코드에는리포지토리.save(); =>인터페이스.save();인터페이스.메서드 를 호출했는데스프링 프레임웍에서 어떤 원리로인터페이스.메서드 => 구현체클래스.메서드가 호출되는지이해가 가지 않습니다 바쁘시겠지만 시간 나실때 답변 주시면 감사하겠습니다수고하세요.. #JPA#구현체#하이버네이트#hibernate
-
미해결스프링 부트 웹 개발 입문 - 따라하며 배우기
DB Table 생성, 데이터 입력 문의
테이블 구조에 관해 몇가지 문의드립니다.coffee_menu_log 쿼리문이 없어 기존 테이블을 삭제(학습하면서 테스트한다고 무작위로 들어간 데이터도 삭제할 겸)했습니다. 그런데 테이블을 작성하면서 좀 아리송한 부분이 있어 문의드립니다. cust_info 테이블의 cust_id 컬럼 구조가 유니크한 큐로 유지되는 구조가 맞나요?그리고 order_list의 외래 키의 이름이 조금 달라 문의드립니다.이러한 질문을 드리는 이유는 sql 파일에 존재하는 테이블 수정의ALTER TABLE order_listADD CONSTRAINT fk_cust_idFOREIGN KEY(cust_id)REFERENCES cust_info(cust_id)에서키가 유니크한 키가 아닌 포린키로 지정되어 있어. 문의드립니다. 유니크한 키에서 이후 포린 키로 변경해야 하나요?
-
해결됨타입스크립트 입문 - 기초부터 실전까지
ts 핸드북에 나오는 void 질문
안녕하세요!null값은 void로 선언 시 이렇게 되는데 제가 실수한 게 있나요???
-
해결됨Do it! 알고리즘 코딩테스트 with JAVA
[그래프의 표현 실전 문제] 이분 그래프 판별하기(백준 1707) 코드 오류
강사님 항상 유익한 수업 잘 듣고 있습니다! 무료로 강의를 열어주셔서 정말 감사드립니다.[그래프의 표현 실전 문제] 이분 그래프 판별하기(백준 1707) 강의에서 38번째 라인 코드를 'DFS(1)'에서 'DFS(i)'로 수정이 필요해 보입니다.
-
미해결Redux vs MobX (둘 다 배우자!)
리덕스 사가 실습 파일 확인 부탁드립니다!
안녕하세요 제로초님 좋은 강의 잘 보고 있습니다!리덕스 사가 실습을 해보고 싶어서 노드버드 깃헙 파일 클론해서 npm i 하고 실행을 하니 next랑 react dependency가 발생해 version update도 해봤지만 잘 안되더라구요 ㅠㅠ 혹시몰라서 ch7도 해봤지만 잘 되지 않았습니다.ch3 코드기준으로 실습하면 좋던데 혹시 실습파일 확인 후 재업로드 한번 부탁드려도 될까요? ㅠㅠ
-
미해결[개정판] 딥러닝 컴퓨터 비전 완벽 가이드
Segmentation
안녕하세요, 선생님.pretrained 모델을 기반으로 해서 segmentation하는 custom 모델을 만드려고합니다.관련 코드가 섹션 15 Mask RCNN에 opencv_mask_rcnn_infrence인 것 같아 참고하고 있는데요.그래서 먼저 CVAT 툴을 이용하여 train, val job을 각각 만들고 폴리곤으로 이미지에 손상 영역을 그려주었습니다.이후, Export job dataset - coco 1.0 포맷으로 내보냈는데coco 1.0과 coco kepoints 1.0의 포맷 차이가 궁금합니다. 그리고 어떤 포맷으로 내보내는게 정답인지도 궁금합니다. 또, 그리고 나서 labels_to_names_seq= {0:'gap'} 로 클래스명을 수정 매핑해주고다른 코드는 수정하지 않고 돌리는데 오류가 떠서 무슨 문제인지 몰라 여쭤봅니다. 추가적으로 전혀 다른 분야의 새로운 이미지를 라벨링해서 쓸 때 어떠한 부분을 수정하여야 하고 유의해서 써야하는 지 답변해주실 수 있으실까요..부탁드립니다!
-
미해결[코드팩토리] [초급] Flutter 3.0 앱 개발 - 10개의 프로젝트로 오늘 초보 탈출!
Windows로 작업한 내용물을 그대로 Ios빌드용으로 사용가능한가요?
안녕하세요! 앱 만들어보고 싶어서 수강신청을 하게됐습니다. 반갑습니다ㅎㅎ빌드 환경에서 궁금한게 있습니다...! Windows에서 작업한 프로젝트를 그대로 Ios에서 빌드용 프로젝트로 사용이 가능한가요?혹시 IOS에서는 IOS 빌드 및 출시와 Android 빌드 및 출시 두 개 다 가능한가요?만약에 2번 경우가 가능하면 아에 맥북을 사는 것도 고려를 해봐야할것같네요...ㅎㅎ 그럼 중급수업까지 잘 들어보겠습니다. 감사합니다.
-
미해결Jenkins를 이용한 CI/CD Pipeline 구축
ssh root@localhost -p 10022 접속시 Connection closed by remote host
Intel Mac 에서"SSH Server 설치 챕터"를 공부중에 궁금한게 있어 문의드립니다.Logs위에 처럼 도커 설치후 정상 Running 되는거 확인 및tomcat 8088동작 확인 된 상태에서명령어 창에서 ssh root@localhost - p 10022 이걸 치면kex_exchange_identification: Connection closed by remote hostConnection closed by ::1 port 10022나오는 어떻게 해야 될지 난감하네요.조언 부탁드립니다.감사합니다.
-
미해결[개정판] 파이썬 머신러닝 완벽 가이드
LemNormalize 함수 관련 질문
안녕하세요 선생님. 먼저 좋은 강의 감사드립니다.함수 관련 질문이 있어 드리게 되었습니다. remove_punct_dict = dict((ord(punct), None) for punct in string.punctuation)def LemNormalize(text): return LemTokens(nltk.word_tokenize(text.lower().translate(remove_punct_dict)))여기에서 .translate(remove_punct_dict) 부분이 잘 이해가 되지 않아 질문을 드립니다! 이 부분이 stop_words를 제거하는 코드라는 것은 이해했으나, 어떻게 작동하는지 궁금하여 질문을 드립니다.감사합니다.
-
미해결대세는 쿠버네티스 (초급~중급편)
vagrant up 에러 관련 문의드립니다.
안녕하세요. vagrant up 명령어를 입력하였는데 다음과 같이 에러가 발생합니다.. 인터넷에 찾아봐도 내용이 없는 것 같아 질문드립니다..윈도우11을 사용하고있어서 그런건가요..?
-
해결됨[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part3: 유니티 엔진
@Managers 생성 질문드립니다.
디버깅을 통해 @Managers가 생성되는 곳이 BaseScene에 Init이라는 것을 파악했지만, Init과 Managers.Resource.Instantiate 호출로 연관 없는 @Managers까지 생성되는 이유를 모르겠습니다.BaseScene.csprotected virtual void Init(){Object obj = GameObject.FindObjectOfType(typeof(EventSystem));if (obj == null)Managers.Resource.Instantiate("UI/EventSystem").name = "@EventSystem";}ResourceManager.cspublic GameObject Instantiate(string path, Transform parent = null){GameObject original = Load<GameObject>($"Prefabs/{path}");if (original == null){Debug.Log($"Failed to load prefab : {path}");return null;}if (original.GetComponent<Poolable>() != null)return Managers.Pool.Pop(original, parent).gameObject;GameObject go = Object.Instantiate(original, parent);go.name = original.name;return go;}
-
미해결스프링 핵심 원리 - 기본편
daoImpl이 implements된 Repository인가요?
저는 늘 스프링에서controller -> Service -> ServiceImpl -> Dao -> mapper.xml 이렇게 개발해왔었는데 강의에선 파일명칭?이 달라서 여쭤봅니다. Repository는 dao에서 @Repository로 사용했었는데요 아래 소스의 Repository(MemberRepository)는 위 순서에서 dao에 해당하는 거고 MemoryMemberRepository는 daoImpl (daoImpl,,, 서비스 Impl 하는 것처럼 dao의 구현체 정도라고 생각하면 될까요?
-
미해결앨런 iOS 앱 개발 (15개의 앱을 만들면서 근본원리부터 배우는 UIKit) - MVVM까지
cornerRadius가 적용이 안되는 문제가 있어 질문드립니다.
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요.안녕하세요. 앨런님현재 코드로 ToDoApp을 만들고 있는데 DetailView 부분을 코딩하면서 색상 버튼 부분에 cornerRadius가 적용이 안되는 문제가 있어 질문드립니다.현재까지 제가 해결을 위해 확인한 부분은 아래와 같습니다.setupSaveButtonConstraints()를 호출 시 red, green, blue, purple 버튼에 cornerRadius 적용되지 않습니다.setupButtonCorner() 함수의 호출 지점을 layoutSubView()의 super 호출 전 또는 후로 설정해 보았지만 적용되지 않았습니다.setupButtonCorner() 함수에서 button에 height를 설정해서 실행해 보았지만 적용되지 않았습니다.이 문제를 해결할 수 있는 방법이 뭐가 있을까요?import UIKit final class DetailView: UIView { // MARK: - Color Buttons let redButton: UIButton = { let button = UIButton() button.setTitle("Red", for: .normal) // button.setTitleColor(MyColor.red.buttonColor, for: .normal) // button.backgroundColor = MyColor.red.backgroudColor button.titleLabel?.font = UIFont.systemFont(ofSize: 15) // button.translatesAutoresizingMaskIntoConstraints = false return button }() let greenButton: UIButton = { let button = UIButton() button.setTitle("Green", for: .normal) // button.setTitleColor(MyColor.green.buttonColor, for: .normal) // button.backgroundColor = MyColor.green.backgroudColor button.titleLabel?.font = UIFont.systemFont(ofSize: 15) // button.translatesAutoresizingMaskIntoConstraints = false return button }() let blueButton: UIButton = { let button = UIButton() button.setTitle("Blue", for: .normal) // button.setTitleColor(MyColor.blue.buttonColor, for: .normal) // button.backgroundColor = MyColor.blue.backgroudColor button.titleLabel?.font = UIFont.systemFont(ofSize: 15) // button.translatesAutoresizingMaskIntoConstraints = false return button }() let purpleButton: UIButton = { let button = UIButton() button.setTitle("Purple", for: .normal) // button.setTitleColor(MyColor.purple.buttonColor, for: .normal) // button.backgroundColor = MyColor.purple.backgroudColor button.titleLabel?.font = UIFont.systemFont(ofSize: 15) // button.translatesAutoresizingMaskIntoConstraints = false return button }() lazy var buttons: [UIButton] = [redButton, greenButton, blueButton, purpleButton] lazy var colorButtonStackView: UIStackView = { let st = UIStackView(arrangedSubviews: [redButton, greenButton, blueButton, purpleButton]) st.axis = .horizontal st.spacing = 15 st.alignment = .fill st.distribution = .fillEqually return st }() // MARK: - Text View let mainTextView: UITextView = { let textView = UITextView() textView.backgroundColor = .clear textView.font = UIFont.systemFont(ofSize: 14) textView.textColor = .black return textView }() lazy var backgroundView: UIView = { let view = UIView() view.addSubview(mainTextView) view.backgroundColor = MyColor.red.backgroudColor return view }() // MARK: - Update Button let saveButton: UIButton = { let button = UIButton() button.titleLabel?.font = UIFont.systemFont(ofSize: 15) button.setTitleColor(.white, for: .normal) button.backgroundColor = MyColor.red.backgroudColor return button }() override init(frame: CGRect) { super.init(frame: frame) setupDetailView() setupButtonColor() setupConstraints() } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } func setupDetailView() { self.backgroundColor = .white self.addSubview(colorButtonStackView) self.addSubview(backgroundView) self.addSubview(saveButton) backgroundView.clipsToBounds = true backgroundView.layer.cornerRadius = 10 saveButton.clipsToBounds = true saveButton.layer.cornerRadius = 8 layoutSubviews() } func setupConstraints() { setupColorButtonSVConstraints() setupBackgroundViewConstraints() setupMainTextViewConstraints() // 왜 이걸 설정하면 색깔 버튼의 cornerRadius가 변경이 안될까요? setupSaveButtonConstraints() // setupButtonCorner() } func setupColorButtonSVConstraints() { print(#function) colorButtonStackView.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ colorButtonStackView.leadingAnchor.constraint(equalTo: safeAreaLayoutGuide.leadingAnchor, constant: 25), colorButtonStackView.trailingAnchor.constraint(equalTo: safeAreaLayoutGuide.trailingAnchor, constant: -25), colorButtonStackView.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor, constant: 20), // colorButtonStackView.bottomAnchor.constraint(equalTo: backgroundView.topAnchor, constant: -40), colorButtonStackView.heightAnchor.constraint(equalToConstant: 35) ]) } func setupBackgroundViewConstraints() { print(#function) backgroundView.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ backgroundView.leadingAnchor.constraint(equalTo: safeAreaLayoutGuide.leadingAnchor, constant: 25), backgroundView.trailingAnchor.constraint(equalTo: safeAreaLayoutGuide.trailingAnchor, constant: -25), backgroundView.topAnchor.constraint(equalTo: colorButtonStackView.bottomAnchor, constant: 40), // backgroundView.bottomAnchor.constraint(equalTo: saveButton.topAnchor, constant: -40), backgroundView.heightAnchor.constraint(equalToConstant: 200) ]) } func setupMainTextViewConstraints() { print(#function) mainTextView.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ mainTextView.leadingAnchor.constraint(equalTo: backgroundView.leadingAnchor, constant: 15), mainTextView.trailingAnchor.constraint(equalTo: backgroundView.trailingAnchor, constant: -15), mainTextView.topAnchor.constraint(equalTo: backgroundView.topAnchor, constant: 8), mainTextView.bottomAnchor.constraint(equalTo: backgroundView.bottomAnchor, constant: -8) ]) } func setupSaveButtonConstraints() { print(#function) saveButton.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ saveButton.leadingAnchor.constraint(equalTo: safeAreaLayoutGuide.leadingAnchor, constant: 25), saveButton.trailingAnchor.constraint(equalTo: safeAreaLayoutGuide.trailingAnchor, constant: -25), saveButton.topAnchor.constraint(equalTo: backgroundView.bottomAnchor, constant: 40), saveButton.heightAnchor.constraint(equalToConstant: 40) ]) } func setupButtonColor() { print(#function) buttons.forEach { button in button.setTitleColor(MyColor(rawValue: Int64(buttons.firstIndex(of: button)!) + 1)?.buttonColor, for: .normal) button.backgroundColor = MyColor(rawValue: Int64(buttons.firstIndex(of: button)!) + 1)?.backgroudColor } } override func layoutSubviews() { print(#function) super.layoutSubviews() setupButtonCorner() } func setupButtonCorner() { print(#function) buttons.forEach { button in button.clipsToBounds = true button.layer.cornerRadius = button.bounds.height / 2 } } }
-
미해결[2025년 출제기준] 웹디자인기능사 실기시험 완벽 가이드
레이아웃 B타입 만들기 footer-inner 작동오류
index.html<div class="footer-inner"> <footer> <div class="footer-logo"></div> <div class="copyright"> <div></div> <div></div> </div> </footer> </div> style sheet.footer-inner{ background-color: beige;}footer{ border: 1px solid green; width: 1200px; margin: auto;}footer > div { height: 100px; box-sizing: border-box; float: left;}.footer-logo{ border: 1px solid pink; width: 200px;}.copyright{ width: 1000px;}.copyright > div { border: 1px solid black; height: 50px; } footer-inner 부분만 먹히지 않아요... background-color를 줘도 실행이 안됩니다ㅠㅠ